Modified the grouping penalty