More robust collision detection