fixed the dfs impl - identical ordering for iterative and recursive
merged changes from pantagruel