a bit clearer function name
finally have recursion working correctly, but the code has grown convoluted enough that the next task is likely to be a complete rewrite