Changed sums to sum +=