Create and use separate class for main window.