Refactoring twig helpers