Pass replacements by reference and rename function.