changed visitied to a dictionary