add support for custom comparator
made userComparator final
Reorganize comparator code