Merging documents