restructuring templateNode added functions.h