added gamma and weights