first pass at adding templating to standalone functions