long ways to go still!
fixes to middleware, missing require statements