Combine string replacements for each section

combine string replacements for each section to fix bug where lines were
duplicated with each replacement.