improved window resizing