Reduce nesting in group helper