Refactor patching.