Added merge function.