finished merge method