Allow replace of more than one parameter in template

Initial replace is replacing only the first parameter not all of them.