Completed query builder to spec