Add categories and refactoring tests