Refactor code to organize the tree layout data.
Found new type of relation in link with dir=0, need to eal with this.