mash refactoring