Finish enough MainWindow refactor to compile and link.
Bug fixes towards making it run