reworked the calculation and the csv