Adding 'replace' as a template-usable function