Refactored code
Removed depth variable