Added 3rd state write to state machine.