Added collision detection and local avoidance behavior.