refactored Accumulator logic to make result a member variable