abstracting comparator