added statement for if a tag already exists, to prevent duplicates