Updating templates, and adding 'replace' and 'useExisting' handlers.