updated collision detection