BFS is now generic