Added bfs method