Add a few functions

flattenTree, flattenLeafAncestors and groupLeafs