slightly smarter fsm