work on template functions