Persist object state to localStorage.

Also change how maps are created slightly.