Properly reduce number of elements on per group basis.