remove redundant code from main window.