Added separate constructor for keyfn + comparator