Fix costFunction, estimateCostFunction and the comparison of the costs so they
better reflect the design doc.

And we are back to the stone age