Updated BFS/DFS