Resizing and correctly fitting the window.