A simple implementation of toy FSM