Refactor MainViewController.