added global vars for x and y, fixed bugs, near completed code.
stupid stuff
moar stupid stuff