New fixes for teams, team related js code moved to teams.js