Restored old BFS implementation.