Better checking for duplicate fields