Refactor groups_controller