extracted subMethods from init() in MainWindow to make it more easily
editable in the future and easier to understand