Move visiting functionality to IndexQueue.