need to understand dfs here better