change DFS and BFS