made the merge script to be more versatile