rework weigth and normalizing constant