Made exit key optional for modeSM