Changed the order of the query