Refactoring TeamController and adds new functionality