Clean up template references.