refactor query predicates