add change view logic to MainController