Tree depth

try to catch up the last changes, this method implementation has changed