Substantial refactoring of the RiskModel