implement error management in the calculations part
implement error management in the calculations part