added obstacle avoidance