improve calc_probs