More efficient get_diff implementation

more efficient implementation of diff uses O(nlogn) algorithm by doing sort and merge rather than current O(n^2) algorithm