twig template test update and refactoring