Trying to keep the cursor onscreen

Changed it so that the cursor will not drop off the bottom or left of
the screen. can't stop if from going off the top or the right though