Changed Querying to accept unsorted rankings