Correctly order linked docs
correctly get document level for proper hierarchy display
hierarchy display

compensate additional offset after first insertions
try to use better function names
cleanng