More refactoring. Added array of categories.