Mode refactoring