query builder cleanup