Replacing templates with values