More functional approach to rolling up the numbers

And renamed a variable to have it make more sense