updated middleware to use "use"