added bayes rule