Implemented global middleware

Implemented global middleware. Uses the same mechanisms that route
specific middleware use. This required very minor refactoring and
i'm pretty happy with the results.
Merge pull request #32 from traitorous/global_middleware

Implemented global middleware