I'm guessing your algorithm works on the assumption that each line in file1 corresponds to that same line in file 2 ..? (In other words, line 1 in file 1 should be the same item (aka: program&icon)...