Separated main window code into a separate file