Where is max_teams implemented?