Improved window resizing