Start looping

extract the document processing function
start processing additional documents based on links.