Debugging of the non-recursive part, to be continued...