BFS almost implemented.