Updated deleteLinksFromNonexistent function: