Improved collision detection.