simplifying the query