implemented globals, moved variables there, use global variables for calculating stuff related to screen size, added left and right limits