Implemented new method for obstacle avoidance and refined collisions.