Updated resize event logic.