Fixed middleware example. Closes gh-114. Thanks @warpdesign