Merge function working