Simplifying the risklib is fine, but now it looks like there is too much logic in the engine. Perhaps this block of code could live as a helper function in risklib?