refactored box2d sample, improved performance