Use a proper merging algorithm