partial Rework of algo thanks to Tests ...to be continued