Refactoring Mode encoders