add-in the collision detection code