Fixed indentation
Added operation totalling, and only continue to compute sums if less then total. only add values less then or equal to sum