Changed to simpler form of D. Working well for lg and nlng with Gaussian noise.