add header option validations and support for an alternate primary key