cleanup of main window to separate loading python code