EHN improve running_sum

Improved running sum, more memory efficient