use templates for functions