Added support for queries to use ORDER BY