Some refactoring of how names are generated.