More deduper stuff.
Added some TODO.