depth should reduce by one on each nesting level. Closes #2287.