refactore team and main controller