Updated toFlatHier and docs