Added checking for total