BugFix: firstprefix was being ignored.
Added a simpler uniqueness test

Also, prints duplicate headers and exits if duplicates are found.