I've implemented the basic features of the new algorithm, and sent some results to SMK to see if they make sense. Remaining to be done: sorting of compounds (which can be pulled in from the previous approach), the handling of repeated instances of the root, and the implementation of indent level (which is currently based purely on the length of the key).