Updated window resize functionality