Cleaning up window resize logic