adding a collision detector