Finite State Machine library