state machine clean up, now uses immutable table