improved collision detector