Depth of tree implemented