#38 - Port the Twitter middleware from katana

This is a direct port, no surprises.