Clean up the add_link code