Improved order totals calculation to be more efficient