corrected calculations for each doc