added collision avoidance