Various improvements to the riskengine