groups refactor