Cleaned up sorting of GQL query results.