state-machine lib