[WIP] Refactor ITC code

For some of John's comments, please see bas-rustenburg/bayesian-itc#1