Modify code to tackle grouping problem.