Added non-recursive DFS using a stack