use IDA instead of BFS