Refactored code. Added the category list