Added confidence code.
Commented out irrelevant stuff, remember to fix database write-to code for new analysis code.