Add checking for duplicates.