make bfs faster