fixed the sum-out function tu use the new data structure - works.