now using encode to make templates into strings