Refactoring groups as nodes