Added total amount function