makes an object out of middleware