MainController is refactored