switch find to an iterative dfs