Creating behaviour for the main window.