Duplication checking

Added checks for duplicates that would cause key violations. Fixed a few
transformations such that more rows actually go through all the way to
the Typed tables.