Refactored Bayes classifer