update code for "min depth'