physics engine nearly ported over