using state_machine more accurately