greatly improved collision detection