Implement filtering logic.