Improved collision detection