Refactoring monkey patch