added bayes code