based on Twig Library