Update Template.
Function can be exported and invoked outside now.