mr refactoring