Renamed modeKey to mode for simplicity