Removed threading and modified the 'calculate_sum' method (#9889)