refactor the team service