first level refactor for search/filter