added total probability normalisation loop