Implemented comparator for Pairwise