regen with bfs