added changes to the main window logic