Refactoring of iniApp() method in mainController