team joining and teams refactor