Not really re-reviewing this yet :), but small refactoring thought: instead of storing away all the info (req/res/pause), maybe you could just store a function (generated in the closure in `rewrite()`, similar to the `resume()` function you have in there already) that takes the new body and sends it. That way this command can just look up the function and call it, and all the logic for what the function actually does is localized up in `rewrite()`.