better algorithm for diffs