make the state system a map-map, not a multimap-map, and clean it up