Added DDM. Fixed some minor bugs.