Changed Collision detection to be faster and more robust.