refactor groups