Updated calculation of costs