Moved twig related code to own class