Used listener instead of hacky hack in Twig extension, fixes #14.

I have sandbox changes ready, will submit PR after this one is merged.