Rework existing code into visit_all; add code for visit_single(link)