Add merge, forkMerge and matchMerge functions