FSM implemented using generics and closures