Made trail collision detection more efficient