Lightweight Finite-state Machine (FSM) class