Renamed sum method to total_sum to avoid conflicts with Rails.