MainWindow code layout restructure