prelim template functions