Merging function version 1.2