refactor to reuse selectedTeam.