add comments to template function