working gravity with lots of extraneous debug statements and shiity logic