mostly implemented kain method with gmmdistribution