Also, actually do the thing I said I was doing in the prior checkin by writing state as a string instead of integer. And a bit more cleanup.