Added twig template engine to mod Tpl. Fixed some bugs