Moved patching and unpatching code to the appropriate classes
Merge issue/11 into issue/13