added authehtication middleware, more work needed on this one