Cboptimizationtest

Merge recent developments back to master.