Adjust gravity, clean up code