A hefty commit to try to clean up MainWindow

Attempt 2.  This pretty much works now.