Implemented grouping by group size