Fixed logic for applyPhysics

Also added more documentation