Cleanup of isUnique

isUnique takes the count of the args multiple times.  Store the count in a variable to cut down on overhead.
Merge pull request #5137 from watermark/patch-1

Cleanup of isUnique