Add init function in Main view