refactored filter logic to collection