Refactored confidence builder to work on existing data structure rather than returning a mixed variable type.