Refactor groups usage