refactor QueryBuilder