Recursion replaced by a while loop.
Recursion replaced by a while loop.

This avoids a 'stack level too deep' #328

ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub,ontohub/ontohub