new merge function