'visited' map must be global.

Also rearrange serializers to be right next to the constructor.
Hopefully this helps us remember to change them in tandem.