Clean up some code

Cleaned up initialization code in MainWindow. Also made plot settings persistent.