Added tempalte function