improve query builder