adding template functions from lindsey/pooja