WIP: step 13 - refactoring, plus a performance enhancement and a supposed bug-fix for when a removal truncates a path in the case where the query partial vector trivially disagrees with the SharedPathPrefix. AFAICT tell, this has messed things up completely - this commit may get erased soon.
WIP: step 14 - definite improvement: simplified treatment of SharedPathPrefix so that only fundamental mismatches between different determinate levels cause branches to be introduced or removals to fail. Also fixed a severe bug introduced in the previous commit that was infinitely extending the query partial test vector during removal if it was initially too short. A good proportion of the unit tests now pass, although there are still breakages. We're on the way back up...