adding better detection of duplicate names