tweaked DFS name and simplified BFS