Help please to improve this obstacle avoiding robot project.

I know that I have to take off the delays but if I do it with the code as it is the motors don´t work. That´s why I put them in even when they are not suitable for the task I'm trying to achieve.

Regarding the IF IT IS LESS AND 30 UNITS TURN Northof49 I don´t know what you mean. May I have an example please? Alongside that, even as I tried in many ways to change boolean from true to false when the event of clearing the obstacle is done I haven´t been successful so far.

Is it possible please for someone to give me a routine example? Maybe that way I can understand the concept finally and start experimenting with it.

Thanks to you all for the help you are giving me.