further modularize get_links()
further modularize get_links()