Added new confidence code
Confidence fixes.