refactor code and create team model