refactoring of monkeypatches