Added yesod middleware functionality. Need to test still.