Update state_machine.cpp