add categories and comments and some refactoring