complete simple merging script