adjusted merge to handle multiple source tags