changed some code layout, handle categories in separate directory