credit to book where I ported the physics code from