More stable Bayes factors function