Code refactoring - Adding categories pages - Fixing categories query