Improvement on collision detection