made the comparator class work