One implementation of backtracing

A simple solution is a 'while loop' and that's what we use here.