Better handling of resizing window.