refactoring of the template engine code
unit test and fixes for template_engine
refcatoring with new variables management