MainWindow class refactoring