Added threshold in Integrate and BFS