Move all remaining join dependency stuff from squeel.

- add a TreeNode module to abstract all behaviors in the walk_tree method