Converted functions(which were c macros) to templates