Save the template function for rerendering