reorganize MainWindow constructor. (no functional changes, just looks better)