computeConfidence corrected, main modified