Add merge_i function
Add generic merge function