MerMerge with KS's code