added calculations for total amount