Added collision detection and response.