Refactored NaiveBayesModel