Fixing ClassRisk functions

Maybe a better refactoring is possible, will look into it