Added merge function