minir refactoring