switched to new distributions code, computing gradient and llhod at the same time