updated template functions