updates to middleware