further modularize get_links()