Changed calculation of probabilities. Now it takes into account weights of parameters.