Added the merge function