removal of global variables

use width and height instead of global variables I created before to get
screen size