new version of n square remove dup