CIDC update

Code changes and unit test to reproduce Mike's spreadsheet