Cleaned up template creation.