Clean up core template functions.