Tidy up replace_names

Assumes one name per line and does not call replace
Sleep while waiting for results, use global MATCH_THRESHOLD