Better QueryBuilder implementation