added the start of the tree structure work for threads