Additional middleware

Seperated the reading of the user and client info into a seperate function to be called earlier in the chain