adding better merging mechanism