add grouping function to grouping test