Update computing edit distance and add max threshold for adding items