Changing screen size and code improvement