How Does A Finite State Machine Work