commit initial implementation of the tree alg.