Added function that finds the depth of the tree