added attempt at code to check for duplicates