modified merge script