Clarification of the code
Improvement of the algorithm: non-linear exploration of the grid