updated with dfs