Added comparator to sort in a more intuitive manner.