updated due to bfs