makes the query function more flexible