Refactor to twig