#14 Filtering fixed and refactored