refactored to use ginsfsm