corrected SemanticNode generation;
added TemplateNode generation for for special cases