Implemented sortByTime comparator