tried switching visited to NSDictionary.
Doesn't work any more, duplicates are not eliminated.
changed visited to the more appropriate NSMutableSet, but still not working.
switched visited to NSHashTable. Still not working.
added missing @objc to class State to make NSHashTable work.