refactoring with groups