Rewrote the function for recursively calculating node depth.