simple, but awkward n-ary tree implementation.