Bayesian approach. Doesn't work correct at the moment