Refactored filter & tests