restructured createTeam function