improve comparator