refactoring bayesian with Store protocol