Monoid refactoring