merge_unit function

Merge units