minor tidy up to query endpoint