tidy
more time + memory efficient to use strings for visited