Add depthIterative
Simplify for loop in parensUpwards and path