Adding DGP version of the code, needs more work.