Refactor patching to specific submodule
Minor reorganization of the code, so that additional patching functions (not related to streaming) might be created.

In relation with the initial approach followed in #2631.