I changed the x and y functions to make them foolproof detectors. Everything should be fixed now and slope detection works going down. Not really sure why it doesn't work going up. If you think there is to big of a jump on the corners, change all the 8s to 4s