FSM-free implementation.