Templates refactoring using Twig features