Changed algorithm so it now works outwards in layers; much smaller call stack.  Fixes issue #326