Adding logic to replace tokens in templates using reflection.