Various refactoring in MainWindow.java to make it more compliant with
coding conventions and to remove some technical debt