Tweaking the query builder for #165