Added code that checks if the screen size has changed inside the screnstate