Refactored setFilter to filter