really slow getCleanLinks implementation