First version of twig function