Refactor CollisionDetection

fixed #26