Moved the window-resize code so that it happens whenever there is a