Modified the merge intervals