Implemented tree_depth function