Simplify dfs a little