collision detection and response. intermediate