Realized sum is a built in function.

Changed sum to total in code.