added a bunch of functions to handle the different formats of hierarchy, still working on it but checking in at an intermediate state. Main thing to implement is splitting a hierarchy but this requires a lot of duplicated functions between the memory hierarchy and flat hierarchy. We also need some functions to do queries on the structure -- find all of a certain class or with a certain alias.