test and refactor template helper