i'm not sure this is the best way to solve this problem, though, since with globals you can potentially create unintended bugs. why call the middleware twice? why not just call it once with a bigger object?