improved merging