adding risk function