Updated the collision detection