added function to mainController