refactored the category filter