gravity is upside down but refactored code works