Working version of Merge script