Finished modularizing the tree structure.