Refactoring and splitting into subgroups