Done with implementation of Bayes algorithm