refactoring to categories