Added depth calculation