refactor of query operators