fixed Pair. Added groupBy.