Implemented groupBy.