QueryItems put into a separate function

now all the query routes can just call QueryItems