finished BFS