Refactor Twig class templates