Updated merging script