Updated state_machine for testing.