Refactored MainController to multiple contollers.