fixed nested templates when data to be carried to the nested tempalte was not an array of arrays but just an associative array
added caching to Templates and fixed else statements
added caching to Templates and fixed else statements