It's better to use BFS instead of DFS (optional fix)