refactor groups map to helper