fully working multi-hierarchy code v1 -- or so we hope