Simplify another comparator and tidy code