Deleted test output
Added twig function, refactored code