Implement BASIC middleware functionality.

GoSublime auto formated.. if you feel this should be merged in, let me know your format settings and I'll gladly set them back.