Refactor MainView