refactor teams_controller