updates merge function