Add comparator for sorting.