Improvements for the fsm