add intialize function for middlewares