implementing depth