Fix duplication and various broken stuff.