changed merge function

to return tuple and unique values only