Some code cleanup in MainFrame.