Update merge API

There have been some changes upstream in the merge API. This PR address the changes.

Still work in progress ...