Dedup

I'm too tired to give you a good description of this.