refactoring with filter-merge-filter