Re-wrote a good chunk of the PDD code. (I think I'm happy with it now.)