changed reference to template directory to be absolute;\nadded functions to free data structures only and not data;\nstarted genericizing the printData and freeData functions