Replaced code for retrieving the screen dimensions.