Use Guava's Ordering.greatestOf to avoid sorting
Also add a unit test for ordering and address comments