refactoring of twig environment in TwigRenderer