806 F.2d 862
25 ERC 1346, 6 Fed.R.Serv.3d 937, 2UCC Rep.Serv.2d 1324
UNITED STATES of America, Plaintiff/Appellee,v.The CITY OF TWIN FALLS, IDAHO, Defendant.The CITY OF TWIN FALLS, IDAHO, Third-Party Plaintiff/Appellant,v.HAMILTON AND VOELLER, INC., an Idaho corporation;  DetweilerBros., Inc., an Idaho corporation;  Envirotech Corporation,d/b/a Envirotech Systems, Inc., a foreign corporation doingbusiness in Idaho, Third-Party Defendants/ Appellees.UNITED STATES of America, Plaintiff/Appellee,v.The CITY OF TWIN FALLS, IDAHO, Defendant.The CITY OF TWIN FALLS, IDAHO, Third-Party Plaintiff/Appellant,v.HAMILTON AND VOELLER, INC., an Idaho corporation,Third-Party Defendant,andEnvirotech Corporation, d/b/a Envirotech Systems, Inc.,Third-Party Defendant/Appellant.
Nos. 84-3832, 84-3837.
United States Court of Appeals,Ninth Circuit.
Argued and Submitted Oct. 9, 1985.Decided Dec. 15, 1986.

Randall D. Morrison, Finan, White & Morrison, San Francisco, Cal., for plaintiff/appellee.
John C. Hohnhorst, John C. Hepworth, Hepworth, Nungester & Felton, Twin Falls, Idaho, for defendant.
Appeal from the United States District Court for the District of Idaho.
Before TANG, SCHROEDER,* and BOOCHEVER, Circuit Judges.
BOOCHEVER, Circuit Judge:


1
The United States sued the City of Twin Falls, Idaho for violation of federal water pollution statutes.  The City filed a third-party indemnity action against Envirotech Corporation and others responsible for the design and construction of the City's sewage treatment plant.  The United States prevailed against the City, and the City obtained a jury verdict in its breach of contract and warranties action against Envirotech.  The verdict was for $1,222,493.65, and the district court awarded the City attorney fees and some costs.  The City moved unsuccessfully for a partial new trial on damages.  Envirotech cross-appeals.  The parties raise numerous issues involving jurisdiction, contract formation and modification, Uniform Commercial Code application and remedies, jury instructions, punitive damages, expert witness costs and fees, and attorney fees.

FACTS

2
The City of Twin Falls (the City) needed a new secondary waste treatment plant to meet United States Environmental Protection Agency (EPA) water pollution discharge standards.  Between 1972 and 1974, a Twin Falls engineering firm, Hamilton and Voeller, Inc., designed the facility and prepared specifications for the equipment.  The City solicited bids for the various phases of the project, including site preparation and general construction (Division I), and manufacture and installation of the secondary treatment equipment (Division III).  For its Division III contract, the City required the bidder to guarantee it would meet certain specifications, including a specified rate of dewaterability of sludge1 and a percentage of biological oxygen demand (BOD)2 that would be attained without the use of chemicals.  The successful bidder also was required to agree that it would repair or replace equipment failing to meet specifications within the first year.  If after a two year period the equipment still did not meet specifications, the City had an option to demand the removal of the equipment and refund of payments.


3
Envirotech Corporation (Envirotech) won the bid for supplying and installing the secondary treatment equipment.  The facility was constructed and the treatment system installed between 1974 and 1976.  Problems with the secondary system began immediately, and the system never performed as intended.


4
In September 1976, the United States (for the EPA) commenced an action seeking injunctive relief and civil penalties against the City in the federal district court for the District of Idaho, alleging that the City's sewage treatment plant was discharging various pollutants in violation of federal water pollution standards and the pollution discharge permit issued the City by the EPA.  The district court's jurisdiction was based upon 28 U.S.C. Sec. 1331 (1982) (federal question) and 28 U.S.C. Sec. 1345 (United States as plaintiff).


5
The City denied the allegations, and in March 1978, it joined several third-party defendants, including Envirotech (a California corporation which manufactured and sold the pollution control equipment which is the subject of this appeal).  The answer and third-party complaint alleged that in order to comply with the federal water pollution standards, the City contracted with the third-party defendants to design and build the treatment facility, and that as a result of breach of contract and negligence, the City was "potentially liable to the Plaintiff for daily alleged fines...."  Because there were other third-party defendants defeating diversity, the City in an amended answer asserted jurisdiction as to the third-party defendants based upon the pendent and ancillary nature of this claim.  The City alleged that it had been sued by the United States and that it was "entitled to indemnity for any and all loss occasioned by recovery by the United States," as well as for all costs and attorney fees.  It also sought additional damages arising from the need to repair or replace the treatment plant caused by Envirotech's negligence and breach of express and implied contract warranties.


6
In October 1980, the litigation between the United States and the City was concluded in the United States' favor under the terms of a stipulation and consent decree.  Among other things, the decree required the City to repair and reconstruct the plant to meet its EPA pollution discharge permit requirements.  By the terms of the consent decree, the court retained jurisdiction over the proceedings until the decree terminated on December 31, 1982.  The court observed that, for all practical purposes, the suit between the United States and the City was terminated, that the City's third-party actions presented voluminous and complex state law issues best resolved in the state courts, that the trial was likely to be protracted, and that there appeared to be no complete diversity of jurisdiction.  Nevertheless, the court determined to retain jurisdiction because of the extensive discovery already conducted.


7
The jury returned a verdict against Envirotech for the sum of $1,222,493.65, and judgment was entered accordingly.  Following trial, the City moved for a partial new trial on its measure of damages objection.  The motion was denied.  The City also sought costs including expert fees and costs which it paid its experts for depositions taken by Envirotech.  The City obtained costs of $15,109.79 from Envirotech, but the expert fees and deposition costs were denied.  The City was awarded statutory attorney fees from Envirotech in the amount of $275,000, and Envirotech appeals this award.

ANALYSIS
I. JURISDICTION

8
The court denied Envirotech's motion to dismiss for lack of subject matter jurisdiction.  Envirotech appeals the ruling that the district court had ancillary jurisdiction over the City's third-party claims.  Envirotech argues that the City's third-party claims were pendent party claims, i.e., the City brought in new parties on state law claims which, because of the absence of complete diversity, had no independent basis of federal subject matter jurisdiction.  Envirotech also contends that even if the court had ancillary jurisdiction, it abused its discretion in refusing to dismiss the third-party claims which predominantly involved state law issues.


9
The City responds that the district court possessed ancillary jurisdiction permitting the City to implead third-party defendants under Rule 14(a) of the Federal Rules of Civil Procedure for indemnification of the City's liability as to the original plaintiff, the United States.  Further, once the district court properly exercised its ancillary jurisdiction as to the City's indemnity claims, it also had pendent jurisdiction over the City's remaining damage claims under Rule 18.

Standard of Review

10
This court reviews de novo a district court's decision on subject matter jurisdiction.   Jones v. Gordon, 792 F.2d 821, 824 (9th Cir.1986);  Clayton v. Republic Airlines, Inc., 716 F.2d 729, 730 (9th Cir.1983).

Discussion
A. Ancillary and Pendent Jurisdiction

11
Fed.R.Civ.P. 14(a) permits a defendant, as a third-party plaintiff, to bring an action against a person not a party "who is or may be liable to him for all or part of the plaintiff's claim against him."    Rule 18(a) permits a party asserting a claim to relief as a third-party claimant to join as many claims as he has against the opposing party.  Fed.R.Civ.P. 18(a).

Both ancillary and pendent jurisdiction

12
expand the scope of federal courts by permitting parties to obtain a federal forum for claims which, by themselves, are not within the statutory jurisdiction of the federal courts....  Ancillary claims are claims which ... arise out of the same transactions that are the subject of the federal cause[ ] of action but which are asserted after the original complaint is filed, usually by one other than the original plaintiff.


13
Blake v. Pallan, 554 F.2d 947, 956-57 n. 11 (9th Cir.1977).  The City's indemnity claim against Envirotech arises out of the installation, warranty, and failure of the treatment system to return clean water to the river.  This is the same transaction which was the subject of the federal claim against the City.  The third-party claim is therefore ancillary under this definition.


14
The City's contract and warranty claims involve issues not presented by the United States' complaint.  We must determine whether they are pendent under the provisions of Rule 18(a).  In Blake, we defined pendent claims as "state claims which arise from the same 'nucleus of operative facts' as that of a federal claim and which are joined in the same complaint with the federally cognizable claim by the original plaintiffs against the original defendants."    554 F.2d at 956-57 n. 11.  We have concluded that the City's indemnity claim is ancillary to "the federally cognizable claim."    Viewing the City as the "original plaintiff" in its third-party action against Envirotech as the "original defendant," the City's contract and warranty claims are state claims arising from the same nucleus of operative facts as the indemnity claim, and thus are pendent to its ancillary claim.


15
This court was faced with a similar situation in United States ex rel. Payne v. United Pacific Insurance Co., 472 F.2d 792 (9th Cir.), cert. denied, 411 U.S. 982, 93 S.Ct. 2273, 36 L.Ed.2d 958 (1973).  In Payne, a subcontractor was not paid by his contractor for equipment and labor, and brought suit against the surety of the contractor on performance and payment bonds.  The Miller Act, 40 U.S.C. Sec. 270b (1982), provided the basis of his cause of action.  The surety impleaded the contractor, seeking indemnity for the surety's liability to Payne.  The surety also joined other claims against the contractor on other performance bonds regarding projects, other than the one involving Payne.  Prior to trial, the surety settled the subcontractor's claims.  The district court ruled that the third-party claims were ancillary to the original federal question action.


16
This court agreed that ancillary jurisdiction existed as to the surety's third-party indemnity claim for its liability arising out of the transaction spawning the original action.  We held that "third-party claims are ancillary if the claims arise out of the subject matter of the original action and involve the same persons and issues ... or if they arose out of the same 'transaction or occurrence,' " 472 F.2d at 794 (citations omitted), and that under these tests, the district court properly asserted jurisdiction over the surety's claim for indemnification as to Payne's claims.


17
As to the other claims asserted by the surety against the contractor, however, we found that there was no close nexus between those third-party claims and the original claim brought by Payne.  "The fact that the third-party claim arose from the same general background does not suffice as a nexus."   Id. at 795.


18
Under Payne, ancillary jurisdiction clearly exists as to the City's third-party indemnification claims.  The City's additional claims for breach of contract and breach of express and implied warranties also arise from the same transaction, and unlike the situation in Payne, there is a close factual and logical nexus between the pendent claims added under Rule 18(a) and the original claim.  Therefore, pendent jurisdiction supports these claims.   See also Schwab v. Erie Lackawanna Railroad, 438 F.2d 62 (3d Cir.1971);  Noland Co. v. Graver Tank & Manufacturing Co., 301 F.2d 43, 49-51 (4th Cir.1962).  We hold that the district court properly ruled that ancillary and pendent jurisdiction existed.

B. District Court's Exercise of Discretion

19
Having concluded that there was ancillary and pendent jurisdiction, the next question is whether the district court abused its discretion in retaining the case after the principal federal claim was settled.  Although this court reviews questions of jurisdiction de novo, Clayton, 716 F.2d at 730, once having determined that ancillary jurisdiction exists, this court has said that ancillary jurisdiction, like pendent jurisdiction, is a "doctrine of discretion."   Blake, 554 F.2d at 958 (quoting United Mine Workers v. Gibbs, 383 U.S. 715, 726, 86 S.Ct. 1130, 1139, 16 L.Ed.2d 218 (1966)).  Under the abuse of discretion standard, this court will not reverse unless it has a definite and firm conviction that the court below committed a clear error of judgment in the conclusion it reached upon a weighing of the relevant factors.   Potlatch Corp. v. United States, 679 F.2d 153, 157 (9th Cir.1982).  Justification for ancillary jurisdiction " 'lies in consideration of judicial economy, convenience and fairness to litigants;  if these are not present a federal court should hesitate to exercise jurisdiction over state claims....' "  Blake, 554 F.2d at 958 (quoting Gibbs, 383 U.S. at 726, 86 S.Ct. at 1139).   See also Hill v. Rolleri, 615 F.2d 886, 889 (9th Cir.1980) (where federal diversity jurisdiction over third-party claim existed when trial began, it survived settlement of main action upon which diversity jurisdiction depended).  "Joinder of a state law claim against a pendent party has been allowed if that party has already been brought into the case as a third-party defendant by the party sued on a federal claim."    13B C. Wright, A. Miller & E. Cooper, Federal Practice and Procedure Sec. 3567.2 (1984) (footnote omitted);  see also Ortiz v. United States Government, 595 F.2d 65, 69 (1st Cir.1979).


20
The district court expressed its concern about continuing jurisdiction over the "voluminous" third-party action and the desirability of having the matter tried locally.  The district court was aware that it had a responsibility to reevaluate its jurisdiction throughout the pendency of the litigation.   See Gibbs, 383 U.S. at 727, 86 S.Ct. at 1139.  It requested additional briefing from the parties and made a reasoned determination that it should retain jurisdiction over the action.  Under these circumstances, we cannot say that the district court abused its discretion.

II. CONTRACT FORMATION OR MODIFICATION

21
Envirotech next contends that the district court erred in ruling as a matter of law that Envirotech's Pre-bid Submittal and guarantee letter did not affect its contract with the City.  When the City solicited bids for the sludge treatment system, it required certain specific guarantees:


22
(1) the system was required to treat the sludge so that it would be dewaterable at a minimum rate of 4 lbs/sq.ft./hr.;


23
(2) this rate was to be accomplished without the use of chemicals;


24
(3) the BOD (biological oxygen demand) contained in the recycle streams produced by the system was never to exceed an amount equal to fifteen percent of the BOD contained in the raw sewage influent to the plant;  and


25
(4) if the system failed to meet these specifications within two years of system start-up, the seller was to remove the equipment and refund the price at the City's option.


26
In April 1974, the City's consulting engineer issued its first addendum to the plans and specifications.  The addendum required each bidder to list all changes or exceptions taken with the specifications.  Envirotech argues that it responded with a Pre-bid Submittal which differed from the specifications required by the City.  Envirotech's Pre-bid Submittal stated that because the treatment plant might be required to dewater one hundred percent heat treated waste activated sludge (more difficult to dewater and treat), the loading rate would be less than the City's required 4 lbs/sq.ft./hr.;    that better loading rates could be achieved by using chemicals in the secondary treatment process;  and that the BOD load might be greater than the City required.


27
Envirotech also argues that it submitted a guarantee letter which did not contain all of the guarantees that the City required.  Rather, Envirotech omitted the guarantees concerning dewatering and recycling rates and the provision that chemical treatment was not to be used.  Envirotech argues that it only included the City's requirement concerning the supplier's right to repair and the City's option to require removal and refund.


28
During trial, Envirotech moved for a directed verdict based upon its theory that the Pre-bid Submittal and guarantee letter either defeated the formation of the contract or constituted a counteroffer which was accepted by the City and resulted in an agreement based upon the terms of the letters.  The district court denied Envirotech's motion, ruling as a matter of law that the letters were not adequate to change the contract.  The court instructed the jury that the Pre-bid Submittal and guarantee letter did not affect the contract.  The jury, therefore, was not permitted to consider their effect on the formation or modification of the contract, and in its Special Verdict, specifically found that Envirotech contracted to meet the City's specifications.  Envirotech argues that the district court erred in its ruling, and that it was for the jury to determine whether the documents defeated or modified the formation of the contract.

Standard of Review

29
The interpretation of a contract is a mixed question of law and fact.   Interpetrol Bermuda Ltd. v. Kaiser Aluminum Int'l.  Corp., 719 F.2d 992, 998 (9th Cir.1984).  We review the interpretation of a contractual provision de novo.   Kemmis v. McGoldrick, 767 F.2d 594, 597 (9th Cir.1985);  Interpetrol Bermuda Ltd., 719 F.2d at 998 (the principles of contract interpretation to be applied are questions of law subject to de novo review).  The determination of whether contract language is ambiguous is a matter of law.   In re U.S. Financial Securities Litigation, 729 F.2d 628, 632 (9th Cir.1984).  "If a provision is ambiguous, however, its interpretation depends on the parties' intent at the time of execution."   Kemmis, 767 F.2d at 597.  The district court then should make factual findings as to the parties' actual intent.  Id.  The district court's factual findings concerning what the parties intended, said, and did are reviewed under the clearly erroneous standard.  Id.;  Interpetrol Bermuda Ltd., 719 F.2d at 998;  see also Laborers Health & Welfare Trust Fund v. Kaufman & Broad, 707 F.2d 412, 418 (9th Cir.1983) (intent as issue for trier of fact).


30
Under Idaho law, "where it is contended that a contract has been modified, and the evidence relating to the modification is undisputed and unambiguous, the trial court must decide as a matter of law whether the contract was modified."   Johnson v. Allied Stores Corp., 106 Idaho 363, 368, 679 P.2d 640, 645 (1984) (citations omitted).


31
From these cases we derive the general rule that the determination of the parties' intent to modify a contract is a question of fact for the jury.  There is a threshold, however, where the trial judge must first examine the evidence to determine whether there is an actual ambiguity or uncertainty concerning the parties' intent.  If the judge determines that there is no ambiguity, then the court is entitled to rule as a matter of law whether the contract was modified.   In re U.S. Financial Securities Litigation, 729 F.2d at 632.  We review the district court's legal determination de novo.   United States v. McConney, 728 F.2d 1195, 1202-04 (9th Cir.)  (en banc), cert. denied, 469 U.S. 824, 105 S.Ct. 101, 83 L.Ed.2d 46 (1984);  United States ex rel. Union Building Materials Corp. v. Haas & Haynie Corp., 577 F.2d 568, 572 (9th Cir.1978).

Discussion

32
We hold that the court did not err in ruling as a matter of law that the Pre-bid Submittal and guarantee letter did not modify or defeat the formation of the contract.  Initially we observe that the first addendum, which instructed bidders to list all changes and exceptions taken with the specifications, also contained the following provision:


33
The thermal conditioning system offered shall condition raw primary or waste activated sludges or mixtures of the two as specified, so that the sludge can be dewatered on the vacuum filters without the addition of chemicals or any other filter aid.  The thermally conditioned product ... shall be dewaterable according to the performance requirements of Section C [of the original specifications for] Basis of Design.


34
(Emphasis added).  Thus, the very addendum which Envirotech argues invited changes to the specifications, clearly indicates that the City expected dewatering and conditioning of the sludge without the use of chemicals and in accordance with the contract specifications.


35
Second, we note that neither the Pre-bid Submittal nor the guarantee letter submitted by Envirotech actually lists any changes or takes any exception whatever with the original specifications.  Nor did Envirotech specifically take exception with the provision of the addendum set out above.  Rather, Envirotech speculates that the treatment plant "may have to dewater one hundred percent heat treated waste activated sludge," and that when "just waste activated sludge ... is being processed ... the return ... can have a total ... BOD up to thirty percent...."  Further, Envirotech "recommend[s] that a chemical feeding system be added...."  More is required to reach that threshold of ambiguity necessary to send to the jury the question of the parties' intent concerning contract formation or modification.


36
Finally, Envirotech has produced no evidence that when it signed the contract, it had not bound itself to the specifications and conditions contained therein.  Thus, even assuming that the Pre-bid Submittal and guarantee letter served to take exception with the specifications, Envirotech subsequently signed the contract which included both the original specifications and the explicit provision earlier quoted from the first addendum.  Reviewing the contract terms de novo, we find that the terms are unambiguous, that Envirotech signed the contract containing those terms, and that the Pre-bid Submittal and the guarantee letter were not sufficient to modify the contract.  We therefore affirm the district court's ruling.

III. APPLICABILITY OF THE UCC

37
Envirotech next contends that the district court erred in ruling as a matter of law that Envirotech's contract with the City was a sale of goods contract within the scope of the Uniform Commercial Code (UCC), rather than a construction contract not within the UCC, and that the district court should have submitted this as a question of fact to the jury.

Standard of Review

38
In response to Envirotech's motion for directed verdict, the district court ruled that it was "satisfied it is a matter of law that this was a contract for the sale of goods.  I'll have to apply the UCC."    "Ordinarily, the question whether a particular transaction is a construction contract or a contract of sale is an issue of material fact, which must be resolved at trial," Holden v. Placid Oil Co., 512 F.Supp. 644, 647 n. 2 (E.D.La.1981) (where district court ruled in a summary judgment proceeding that the transaction was a sale of goods), but when the evidence so clearly indicates undisputed facts that no jury issue remains to be resolved, it is proper for the court to rule on the issue.  Thus, if the contract was unambiguous, it was not error for the district court to make its determination as a matter of law.Discussion


39
Chapter 2 of the Idaho Uniform Commercial Code-Sales is applicable to "transactions in goods."    Idaho Code Sec. 28-2-102 (1980).  " 'Goods' means all things (including specially manufactured goods) which are movable at the time of identification to the contract for sale...."  Id. Sec. 28-2-105(1).  The Idaho Supreme Court has not enunciated a test for determining whether contracts involving both sales of goods and services are governed by the Idaho UCC.


40
In Haas & Haynie Corp., this court was faced with the problem of mixed sales and services contracts.


41
There is some question as to whether Article 2 of the Uniform Commercial Code is applicable to the contract at issue here.  Article 2 applies to the sale of goods and this contract involves both sale of goods and provision of services.  The modern trend is to apply Article 2 to such mixed sales/services contracts.


42
577 F.2d at 572 n. 2 (the court said it did not need to decide how Hawaii would resolve the issue because the result it reached was the same whether or not the UCC applied) (citing Bonebrake v. Cox, 499 F.2d 951, 958 (8th Cir.1974)).


43
In Bonebrake, the Eighth Circuit reversed a decision that the UCC did not apply where the contract provided for the rendition of services for the installation of bowling alley lanes and equipment.  "[T]he fact that the contract 'involved substantial amounts of labor' does not remove it from inclusion under the Code...."  Id. at 959.  The court then enunciated the test which this circuit in Haas regarded as the "modern trend":


44
The test for inclusion or exclusion is not whether they are mixed, but, granting that they are mixed, whether their predominant factor, their thrust, their purpose, reasonably stated, is the rendition of service, with goods incidentally involved (e.g., contract with artist for painting) or is a transaction of sale, with labor incidentally involved (e.g., installation of a water heater in a bathroom).


45
Id. at 960 (footnotes omitted).   Accord Omaha Pollution Control Corp. v. Carver-Greenfield Corp., 413 F.Supp. 1069, 1085 (D.Neb.1976).


46
The purpose of the City's contract with Envirotech was to purchase and install equipment which would separate and dispose of sludge produced in the secondary treatment of waste water.  Some of the contract documents refer to "construction" and "contractors."    On the other hand, other contract documents and documents prepared by Envirotech indicate the contract was for goods.  See, e.g., Contract Specifications Addendum 1 at Envirotech's Excerpt of Record page 3:  Division III.  "Included shall be the percentage of the total selling price for which the supplier is furnishing and installing the particular piece of equipment, to include and cover piping ..., high pressure pump(s) and sludge grinders, heat exchanger(s), reactor, boiler ..., vacuum filters and support equipment, etc., required for the complete installation."    These all are movable goods as contemplated by Idaho Code Sec. 28-2-105(1).


47
Applying the Bonebrake test, we find that the predominant factor, thrust, and purpose of the contract with Envirotech was for the sale of goods, with a necessary, non-divisible, but incidental services component.  We agree with the district court and hold that as a matter of Idaho law, this contract was governed by the Idaho Uniform Commercial Code.

IV. CONTRACT REMEDY

48
The district court ruled as a matter of law that the contract provided the City with a specific "exclusive remedy" which the City had "elected," limiting the City's recovery to the purchase price of the equipment, costs of its removal, minor damages suffered before its replacement, and prejudgment interest.  The contract provision at issue provides:

E. GUARANTEES

49
(4) If performance of the sludge treatment system in compliance with the specification and to the satisfaction of the Engineer is not attained within two years after completion and startup of the treatment plant, the equipment manufacturer shall remove his equipment and refund the cost of the equipment and its installation at the option of the Owner.


50
On March 21, 1978, the City Manager sent a letter to Envirotech's Senior Vice President, which stated:


51
This letter is your notification that the provisions of specifications paragraph ... E(4) ... of your contract.... must be implemented....  No action or response on your part has been initiated to date therefore it is expected that you will remove your equipment from the plant site and refund the cost of the equipment and its installation, just exactly as you contracted to do.


52
Please be advised that your failure to perform your contractual obligation immediately as stated above may result in the City removing your equipment for you at your expense.


53
The City contends that the district court erred because the contract remedy was not exclusive as a matter of law and that the City is entitled to all remedies and damages available under the Idaho UCC.  Envirotech responds that the court ruled correctly regarding the exclusive nature of the contract provision.  Envirotech also argues that the provision is a liquidated damages provision and as such the City is not entitled also to recover compensatory damages;  the City elected its remedy, which did not fail of its essential purpose;  and the City is not entitled to replacement costs or "cover" for a different sewage treatment plant.  Finally, Envirotech argues that the costs of the replacement plant were paid by the government and the court incorrectly ruled that the collateral source rule applied.

Discussion
A. Exclusive Remedy

54
Under the Idaho UCC, parties to a contract may provide for an exclusive, limited remedy in the event of breach.  Idaho Code Sec. 28-2-719(1) (1980).  Before a remedy will be deemed exclusive, however, the parties must have clearly intended and provided for exclusivity.  Subsection (b) of Idaho Code Sec. 28-2-719(1) provides:


55
resort to a [contractual] remedy as provided is optional unless the remedy is expressly agreed to be exclusive, in which case it is the sole remedy.


56
Accord Jensen v. Seigel Mobile Homes Group, 105 Idaho 189, 196, 668 P.2d 65, 72 (1983) (finding that repair was not intended as an exclusive remedy);  see also Idaho Code Sec. 28-2-719, Official Comment No. 2 (presumption that remedies are cumulative rather than exclusive);  cf. Clark v. International Harvester Co., 99 Idaho 326, 337-39 & n. 9, 581 P.2d 784, 795-97 & n. 9 (1978) (court reviewed language of an express limited repair-or-replace warranty which provided that the rights were "in lieu of all warranties, express or implied, ... [and] all other obligations or liabilities, including liability for incidental or consequential damages," and held that the intent "clearly expressed by its terms" was to limit purchaser's remedy to repair-or-replace).


57
The contract before this court contains no language of exclusivity.  The record indicates no provisions or language limiting the City's remedies, and the parties have not contended that there are any other provisions.  Applying the language and policy underlying Idaho Code Sec. 28-2-719(1)(b) and the Idaho decisions in Jensen and Clark, we hold that the provision does not limit the City to an exclusive contract remedy.  Thus, the district court erred in ruling as a matter of law that the clause created an exclusive remedy.  Accordingly, we reverse that ruling and remand for partial new trial to give the City an opportunity to seek its other remedies under the Idaho UCC.

B. Collateral Source Rule

58
The original treatment plant project was funded seventy-five percent by the United States (EPA) and fifteen percent by the State of Idaho.  The United States and the State of Idaho also paid a substantial portion of the cost of the replacement facilities after the original equipment failed to perform.  The district court ruled that these federal and state replacement payments were from a "collateral source," and held that under the collateral source rule, Envirotech could not offset its contract liability and must respond in damages regardless of the source of funds used for repair.


59
That a party's liability is not reduced by payments or other benefits received by the injured party from collateral sources is a well-recognized principle in tort law, Restatement (Second) of Torts Sec. 920A (1977), and Idaho follows this tort principle.   Lasselle v. Special Products Co., 106 Idaho 170, 174, 677 P.2d 483, 487 (1983).  Further, courts generally have encountered little difficulty in applying the collateral source rule to payments made voluntarily and gratuitously, or even where the funds are given to plaintiff by a government agency, e.g. Roundhouse v. Owens-Illinois, Inc., 604 F.2d 990, 994 (6th Cir.1979), or by way of a government grant, Town of East Troy v. Soo Line Railroad Co., 476 F.Supp. 252, 253-54 (E.D.Wis.1979), aff'd, 653 F.2d 1123, 1132 (7th Cir.1980), cert. denied, 450 U.S. 922, 101 S.Ct. 1373, 67 L.Ed.2d 351 (1981).   See also Wheatland Irrigation District v. McGuire, 562 P.2d 287, 302 (Wyo.1977) (citing cases).  In Alesko v. Union Pacific Railroad Co., 62 Idaho 235, 243, 109 P.2d 874, 878 (1941), the Idaho Supreme Court likewise held that the collateral source rule barred evidence of government relief benefits for flood damage caused by defendant.


60
Assuming that the funds granted by the United States and the State of Idaho to aid in the replacement of the treatment facility were a collateral source, the question is whether the collateral source rule applies in a contracts case.  This issue presents a pure question of state law:  whether Idaho courts would apply the collateral source rule to preclude offsetting remedial grants or benefits provided by the government from the amount of damages for breach of contract.  We review the district court's determination of this issue de novo.   Meckert v. Transamerica Insurance Co., 742 F.2d 505, 506 (9th Cir.1984).


61
We have found no authority to support the application of the collateral source rule in the contracts field.  Authority is to the contrary.   Daniel Construction Co. v. International Union of Operating Engineers, Local 513, 570 F.Supp. 299, 303 (E.D.Mo.1983) ("The doctrine simply is not applicable to breach of contract cases"), aff'd on other grounds, 738 F.2d 296 (8th Cir.1984);  Grover v. Ratliff, 120 Ariz. 368, 370, 586 P.2d 213, 215 (Ariz.App.1978) ("The collateral source rule is a concept of damages in tort cases and does not apply to an ordinary breach of contract case.");   see also United Protective Workers of America, Local No. 2 v. Ford Motor Co., 223 F.2d 49, 54 (7th Cir.1955) ("We have been unable to find a single case in which this rule has been carried over to contract damages.");    D. Dobbs, Handbook on the Law of Remedies 587 (West 1973) ("the collateral source rule is not used at all in contracts claims").


62
The policy rationales underlying the collateral source rule also do not support its application to contract cases.  See Restatement (Second) of Contracts Sec. 347 comment e (1979) (the principle "is less compelling in the case of a breach of contract than in the case of a tort").


63
[I]t is the position of the law that a benefit that is directed to the injured party should not be shifted so as to become a windfall for the tortfeasor.  If the plaintiff was himself responsible for the benefit, as by maintaining his own insurance or by making advantageous employment arrangements, the law allows him to keep it for himself.  If the benefit was a gift to the plaintiff from a third party or established for him by law, he should not be deprived of the advantage that it confers....


64
Perhaps there is an element of punishment of the wrongdoer involved.


65
Restatement (Second) of Torts Sec. 920A comment b (1977).  Thus, if there must be a double recovery, the law prefers that the injured victim receive it rather than the tortfeasor.  Cf. Fleming, The Collateral Source Rule and Loss Allocation in Tort Law, 54 Cal.L.Rev. 1478, 1545 (1966) ("Yet there is evident uneasiness about this result.  That double recovery runs against the grain is attested ... by the evident judicial distaste for extending it to borderline situations, such as cases of contractual liability.").


66
In actions for breach of contract only such damages will be allowed as fairly compensate the injured party for his loss.   Anderson v. Gailey, 100 Idaho 796, 800, 606 P.2d 90, 94 (1980) (citations omitted).  The Idaho court explained:


67
"[A]s a general proposition ... the purpose or objective of the court is to place the injured party ... in the position no better and no worse than he would have occupied had the contract been performed."  ...


68
We have long held in Idaho that the purpose of awarding damages for breach of contract is to fully recompense the non-breaching party for its losses sustained because of the breach, not to punish the breaching party.


69
Id. at 801, 606 P.2d at 95 (quoting King v. Beatrice Foods Co., 89 Idaho 52, 58-59, 402 P.2d 966, 969 (1965)) (citations omitted).


70
With these principles in mind, we believe that if the Idaho Supreme Court were presented with this issue, it would hold, as we do here, that the collateral source rule does not apply to preclude the offset of funds granted by the United States and the State of Idaho from the amount of damages sustained by the City caused by Envirotech's breach of contract.

C.

71
In view of our decision on contract remedy issues, we need not address the City's and Envirotech's other arguments concerning the City's measure of damages.


72
V. AMENDMENT OF COMPLAINT FOR PUNITIVE DAMAGES


73
The City next contends that the district court erred in failing to permit the City to amend its complaint to add a claim for punitive damages.  The City urges that the availability of punitive damages is an issue of fact for resolution by the jury, and that the court invaded the jury's province in determining the merits of the propriety of punitive damages.  Envirotech argues that the court properly exercised its discretion in denying the City leave to amend its complaint because to do so at such a late date during the course of the trial would have been prejudicial.


74
In March 1978, the City filed its third-party claim against Envirotech.  Jury trial began on November 8, 1983.  On December 30, 1983, the City moved to amend its complaint to add a claim for punitive damages.  The court ruled that it was inclined to allow the City to amend its complaint to add the claim, but that it probably would not submit the issue to the jury.  Envirotech objected to allowing the amendment, arguing that it would be prejudiced by the City presenting theories of fraud, malice, and oppression to the jury even if the court ultimately disallowed the claim.  Further, Envirotech argued that its entire trial strategy, including discovery, exhibits, witnesses, and defenses, was prepared with a view to responding only to the City's contract, warranty, and negligence claims.  The court ordered its statement that the motion was granted be rescinded, and ruled that the motion was under advisement.


75
On January 31, 1983, the City renewed its motion to amend based on the authority of Cheney v. Palos Verdes Investment Corp., 104 Idaho 897, 904, 665 P.2d 661, 668 (1983), which holds that under Idaho law, allowance of punitive damages is a question of fact for the jury.  The court denied the City's motion.

Standard of Review

76
The denial of leave to amend the pleadings after a responsive pleading has been filed is reviewed for an abuse of discretion.   Klamath-Lake Pharmaceutical Association v. Klamath Medical Service Bureau, 701 F.2d 1276, 1292 (9th Cir.), cert. denied, 464 U.S. 822, 104 S.Ct. 88, 78 L.Ed.2d 96 (1983).Discussion


77
Fed.R.Civ.P. 15(a) provides that after a response has been filed, a complaint may only be amended by leave of the court.  This court has held that


78
[m]otions to amend ... are commonly granted.  Although within the trial court's discretion, leave to amend "shall be freely given when justice so requires."  ...  We are required to review the exercise of the trial court's discretion to deny a motion to amend strictly.  Thus, where the record does not clearly dictate the district court's denial, we have been unwilling to affirm absent written findings ... and have reversed findings that were merely conclusory....


79
Klamath-Lake, 701 F.2d at 1292-93 (citations omitted).


80
In Foman v. Davis, 371 U.S. 178, 182, 83 S.Ct. 227, 230, 9 L.Ed.2d 222 (1962), the Supreme Court identified four factors relevant to whether a motion for leave to amend the pleadings should be denied:  undue delay, bad faith or dilatory motive, futility of amendment, and prejudice to the opposing party.  In United States v. Webb, 655 F.2d 977, 980 (9th Cir.1981), this court held that delay alone, no matter how lengthy, is an insufficient ground for denial of leave to amend.  "In the absence of some statement of reasons or findings of fact showing bad faith or prejudice, we cannot determine whether it was an abuse of discretion to deny [the] motion for leave to amend [the] pleadings."    Id.


81
The record shows clearly that Envirotech argued it would be prejudiced by the late amendment adding a claim for punitive damages.  Had the district court expressly based its denial of leave to amend on that ground, the court would have properly exercised its discretion.  It appears, however, that the district court may have denied the motion to amend upon its independent analysis of the merits of the punitive damages claim.  This is contrary to Idaho substantive law which provides that "punitive damage awards are in the first instance a jury decision, subject to the trial court's authority to modify or overturn that jury verdict as a matter of law."   Palos Verdes, 104 Idaho at 904, 665 P.2d at 668.


82
In Palos Verdes, the Idaho Supreme Court affirmed an award of punitive damages in an action for nonpayment and fraud arising out of an oral contract.  In addition to holding that an award of punitive damages "should be left first to the determination of the trier of the fact," id., 665 P.2d at 668, the Court also explained that


83
[t]he justification for punitive damages must be that the defendant acted with an extremely harmful state of mind, whether that state be termed "malice, oppression, fraud or gross negligence" ... or simply "deliberate or willful"....


84
Id. 104 Idaho at 905, 665 P.2d at 669 (citations omitted).   See also Boise Dodge, Inc. v. Clark, 92 Idaho 902, 907, 453 P.2d 551, 556 (1969) (under Idaho law, "punitive damages may be assessed in contract actions where there is fraud, malice, oppression or other sufficient reason for doing so").  Of course, the party seeking punitive damages must make sufficient allegations of fraud or other harmful state of mind to reach the threshold of raising the question of punitive damages for proper presentation to the jury.   See Palos Verdes, 104 Idaho at 905, 665 P.2d at 669 ("sufficient evidence was placed before the jury to raise the question[ ] of defendants' malice").


85
Based upon our review of the exhibits and testimony in the record, we believe that sufficient allegations concerning Envirotech's harmful state of mind were made to state a claim for punitive damages.  For example, the City offered as Exhibit 18 a letter from Envirotech's salesman which characterized the City's consulting engineer as a "novice," and which stated that the salesman "should find no problems in getting him to accept any of my proposals."    Further, in the third paragraph of this letter, the salesman asks, "If there are any unfair advantages I can take in helping set this project up, please notify me of them now so I can incorporate them in the specifications."    Because there was sufficient evidence to raise the question of punitive damages, the district court could not have denied the City's motion to amend its complaint to add a claim for punitive damages on the basis of "futility of amendment," Foman, 371 U.S. at 182, 83 S.Ct. at 230, without abusing its discretion.


86
Normally we would remand to the district court to reconsider, in light of this opinion, its ruling denying the motion to amend.  In this case, however, the highly respected trial judge died during the pendency of this appeal.  This panel is therefore in a better position than a judge unfamiliar with this voluminous record to determine whether the amendment should be allowed.


87
As we have previously indicated, jury trial began on November 8, 1983.  It was not until December 30, 1983, that the City moved to amend its complaint by adding the claim for punitive damages.  Envirotech's trial preparation involved responding to the City's contract warranty and negligence claims only.  We believe that Envirotech would have been substantially prejudiced if required to defend against the punitive damage claim at such a late point in the proceedings.  Moreover, an adequate continuance at that time would have been unduly disruptive of the jury trial.  Accordingly, we conclude that the denial of the motion to amend was not an abuse of discretion.

VI. EXPERT WITNESS FEES AND DEPOSITION FEES
A. Expert Witness Fees

88
The City served a Memorandum of Costs upon the district court, requesting, in part, expert fees in the amount of $170,610.67.  In denying the application for expert fees, the district court said, "I will allow only the $30 a day witness fee for all witnesses, expert or ordinary.  I will not allow extra fees for expert witnesses."    The City requests this court to join the recent trend in other circuits and hold that district courts have the discretion in appropriate cases to award expert witness fees in excess of the statutory amount authorized for witnesses generally.  The City also asks us to remand for the district court to make a finding and exercise its discretion whether to award enhanced expert witness fees in this case.

Standard of Review

89
Whether enhanced expert witness fees may be allowed is a question of law reviewed de novo.   See United States v. McConney, 728 F.2d 1195, 1202-04 (9th Cir.)  (en banc), cert. denied, 469 U.S. 824, 105 S.Ct. 101, 83 L.Ed.2d 46 (1984).

Discussion

90
By statute, witnesses in federal courts "shall be paid an attendance fee of $30 per day for each day's attendance."    28 U.S.C. Sec. 1821(b) (1982).  In Henkel v. Chicago, St. Paul, Minneapolis & Omaha Ry., 284 U.S. 444, 52 S.Ct. 223, 76 L.Ed. 386 (1932), the Court rejected a claim for fees for expert witnesses who had testified at trial, holding that


91
when the Congress has prescribed the amount to be allowed as costs, its enactment controls....


92
Specific provision as to the amounts payable and taxable as witness fees was made by the Congress as early as the Act of February 28, 1799....  The statute now applicable is the Act of April 26, 1926 [the predecessor of 28 U.S.C. Sec. 1821]....  Under these provisions, additional amounts paid as compensation, or fees, to expert witnesses cannot be allowed or taxed as costs in cases in the federal courts.


93
284 U.S. at 446, 52 S.Ct. at 224 (citations omitted, brackets added).  The Court also observed that


94
[t]he Congress has dealt with the subject comprehensively and has made no exception of the fees of expert witnesses.  Its legislation must be deemed controlling and excludes the application in the federal courts of any different state practice.


95
Id. at 447, 52 S.Ct. at 225.


96
Fed.R.Civ.P. 54(d) provides that "[e]xcept when express provision therefor is made ... in a statute of the United States ..., costs shall be allowed as of course to the prevailing party unless the court otherwise directs...."  In combination with Rule 54(d), which grants the district court in the absence of other statutory authority the discretionary authority to award costs to a prevailing party, Henkel would appear to resolve the question of enhanced expert fees in the negative.    Henkel, however, was decided before enactment of the Federal Rules of Civil Procedure.  In a later case, the Supreme Court recognized that Rule 54 authorizes district courts to exercise their discretion "sparingly" to award costs not specifically enumerated in 28 U.S.C. Sec. 1821.   Farmer v. Arabian American Oil Co., 379 U.S. 227, 85 S.Ct. 411, 13 L.Ed.2d 248 (1964).  The Court stated:


97
We do not read that Rule [54(d) ] as giving district judges unrestrained discretion to tax costs to reimburse a winning litigant for every expense he has seen fit to incur in the conduct of his case.  Items proposed by winning parties as costs should always be given careful scrutiny....  Therefore, the discretion given district judges to tax costs should be sparingly exercised with reference to expenses not specifically allowed by statute.


98
Id. at 235, 85 S.Ct. at 416 (emphasis added, brackets added).


99
The rule traditionally followed by federal courts is that expert fees cannot be recovered as costs beyond the statutory allowances provided in 28 U.S.C. Sec. 1821.   E.g., J.T. Gibbons, Inc. v. Crawford Fitting Co., 790 F.2d 1193, 1194-95 (5th Cir.1986) (en banc);  Murphy v. International Union of Operating Engineers, 774 F.2d 114, 132-34 (6th Cir.1985), cert. denied, --- U.S. ----, 106 S.Ct. 1201, 89 L.Ed.2d 315 (1986);  Bosse v. Litton Unit Handling Systems, 646 F.2d 689, 695 (1st Cir.1981);  Cleverock Energy Corp. v. Trepel, 609 F.2d 1358, 1363 (10th Cir.1979), cert. denied, 446 U.S. 909, 100 S.Ct. 1836, 64 L.Ed.2d 261 (1980).


100
In reliance on Farmer, however, other federal courts have held that the prevailing party may recover expert witness fees when the expert's testimony was crucial to the resolution of the case.   See, e.g., Paschall v. Kansas City Star Co., 695 F.2d 322, 338-39 (8th Cir.1982) (" 'While Farmer commands perhaps a tight-fisted exercise of discretion in order to insure moderation in the cost of litigation, it does not mandate parsimony to the extent of precluding recovery of legitimate and indispensible [sic] litigation expenditures.' "  (quoting Roberts v. S.S. Kyriakoula D. Lemos, 651 F.2d 201, 206 (3d Cir.1981)), rev'd on other grounds, 727 F.2d 692 (8th Cir.)  (en banc), cert. denied, 469 U.S. 872, 105 S.Ct. 222, 83 L.Ed.2d 152 (1984);  Roberts, 651 F.2d at 206 ("when the expert's testimony 'played a crucial role in the resolution of the issues presented,' a district court, in its discretion, may award expert fees");  see also International Woodworkers of America v. Champion International Corp., 790 F.2d 1174, 1181-93 (5th Cir.1986) (en banc) (Ruben, J., dissenting) (surveying cases from all circuits).  Even those courts that adhere to the traditional teaching of Henkel and hold that expert witness costs must be limited under 28 U.S.C. Sec. 1821 have recognized flexibility in limited "exceptional circumstances."   See, e.g., Quy v. Air America, Inc., 667 F.2d 1059, 1066 (D.C.Cir.1981);  Illinois v. Sangamo Construction Co., 657 F.2d 855, 864-65 (7th Cir.1981).


101
Against this background, we examine our own precedents concerning costs and expert witness fees.  In Thornberry v. Delta Air Lines, Inc., 676 F.2d 1240, 1245 (9th Cir.1982), vacated on other grounds, 461 U.S. 952, 103 S.Ct. 2421, 77 L.Ed.2d 1311 (1983), a Title VII case, we held without discussing Henkel or Farmer that the district court did not abuse its discretion in awarding costs, including expert witness fees.  Although the opinion is not entirely clear that the court was faced with the precise issue of enhanced expert fees, the parties' briefs revealed that the issue of the trial court's discretion in awarding costs in addition to those allowed by Fed.R.Civ.P. 54(d) and 28 U.S.C. Sec. 1920 was vigorously argued.   See also International Woodworkers, 790 F.2d at 1191 (Rubin, J., dissenting) (reading Thornberry as establishing a permissive rule in allowing enhanced expert witness fees).  In any event, our discussion concerning the scope of the district court's discretion is instructive and bears repeating:


102
The exercise of that discretion may not be unlimited, however.  We note [there is] ... language suggesting that these elements of cost may only go beyond the statutory "limits" (subsistence and transportation) in the presence of special circumstances.  See F.R.Civ.P. Rule 54(d);  28 U.S.C. Secs. 1821, 1920....  It is clear, however, that the required "special circumstances" are largely a matter of the reasonable needs of the party in the context of the litigation.  Thus, in determining whether or not special circumstances exist, the judge must look to the practical litigation needs of the party....  In the instant case, the trial court found that the testimony of the expert computer witnesses was essential both to prove the plaintiff's prima facie case through the use of statistics and to rebut the defendant's ... defense.  That finding is adequately supported by the record, and satisfies us that the trial court properly considered the relationship between the claimed ... expert witness fees and the reasonable needs of the litigation.


103
676 F.2d at 1245.


104
Likewise, in Shakey's Inc. v. Covalt, 704 F.2d 426 (9th Cir.1983), we suggested that under "exceptional circumstances" the district court might exercise its " 'inherent equitable discretionary authority' " to award additional expert fees upon a showing that the expert testimony was "essential to establish[ing] the defense."   Id. at 437 (citation omitted).  We also stated that "[e]xercise of this authority usually requires a prior application to the court to incur the costs in issue."    Id.  We held, however, that under the circumstances in Shakey's, the district court did not abuse its discretion in disallowing additional expert costs.


105
Thus it is clear that we have previously expressed our approval of the district court's exercise of its discretionary authority to award enhanced expert witness fees in the proper case.  We take this opportunity to clarify our position, and hold that district courts have the discretion to award additional expert witness fees upon a finding on the record that the expert testimony was crucial or indispensable in establishing the prevailing party's case or defense.   Twentieth Century Fox Film Corp. v. Goldwyn, 328 F.2d 190, 224 (9th Cir.), cert. denied, 379 U.S. 880, 85 S.Ct. 143, 13 L.Ed.2d 87 (1964), is not to the contrary.  There we merely denied non-witness accounting fees in an antitrust case;  no issue of expert witness fees was presented.  As the cases teach, application for expert witness fees should be given "careful scrutiny," and district courts should exercise their discretion "sparingly."   Farmer, 379 U.S. at 235, 85 S.Ct. at 411.  Because the trial court will better be able to evaluate the importance of expert testimony at the conclusion of the trial, we further hold that prior application and approval of an enhanced fee for the expert's testimony is not required.


106
The district court made no finding regarding allowance of expert fees, so it is impossible to determine whether the court denied the fees in the exercise of its discretion considering the factors discussed supra, or on the basis that the City did not make prior application, or under the belief that enhanced expert fees were not allowable.  We therefore vacate the district court's denial of additional expert fees and remand this issue for the court to make a finding and exercise its discretion consistent with this opinion.

B. Fees of Experts Deposed by Others

107
The City also contends that the district court abused its discretion in requiring each party to pay its own experts when other parties deposed those experts.  The City asked the court for a protective order requiring Envirotech to pay the City's experts for preparing for and attending Envirotech's depositions.  The court denied the motion and required each party in the interim to pay its own experts for depositions by other parties.  The court indicated that the matter would be resolved at the conclusion of the case in connection with the taxation of costs.  The court ultimately denied the City's claim for expert fees, including those associated with the experts' depositions.  Envirotech does not deny that the City's claim falls within the purview of Fed.R.Civ.P. 26(b)(4)(C), but rather argues that each party had several experts and it would make no sense to award the City's deposition fees on appeal without awarding the other parties their fees as well.

Standard of Review

108
The question of whether a type of cost is allowable under the rules is a question of law which we review de novo.   McConney, 728 F.2d at 1202.  The amount of costs awarded is reviewed for an abuse of discretion.   Moore v. Hughes Helicopters, Inc., 708 F.2d 475, 486 (9th Cir.1983).

Discussion

109
Fed.R.Civ.P. 26(b)(4) authorizes the deposition of experts, and subdivision 26(b)(4)(C) specifically provides:


110
Unless manifest injustice would result, (i) the court shall require that the party seeking discovery pay the expert a reasonable fee for time spent in responding to discovery....


111
Fed.R.Civ.P. 26(b)(4)(C) (emphasis added).  The purpose of the rule is to avoid the unfairness of requiring one party to provide expensive discovery for another party's benefit without reimbursement.  4 J. Moore, J. Lucas, & G. Grotheer, Jr., Moore's Federal Practice, p 26.66 (2d ed. 1984).  The language of the rule is mandatory ("shall"), unless manifest injustice would result.  The Advisory Committee Notes explain that the court may decline to award expenses if it finds that manifest injustice would result.  Fed.R.Civ.P. 26(b)(4)(C), Notes of Advisory Committee, 1970 Amendment.


112
In this case, the district court made no findings and provided no explanation as to the reason it denied expert deposition costs.  Before it refuses to order a deposing party to pay the other party's expert, the district court must make a finding of manifest injustice.  In the absence of such a finding, the district court erred in refusing to award the City's expert deposition costs.  Neither the rule nor the Advisory Notes make a distinction between prevailing and other parties.  Thus, it would seem that Envirotech should also benefit from any reconsideration by the district court, and be reimbursed for the reasonable fees incurred for any deposition of its own experts taken by the City, absent findings of manifest injustice.  We reverse and remand so that the court may award the City and Envirotech their expert deposition costs, unless the court articulates findings of manifest injustice.

VII. ATTORNEY FEES

113
Envirotech argues that the district court erred in awarding the City attorney fees pursuant to Idaho Code Sec. 12-120(2) (1979) (Sec. 12-120(3) as amended), because that section applies only to contract actions "relating to purchase or sale of goods."    Our holding that the contract was for the sale of goods as defined by the Idaho UCC disposes of that contention.  We affirm the award of attorney fees.


114
The City claims attorney fees on appeal pursuant to Idaho Code Sec. 12-120(2), which provides:


115
In any civil action to recover on ... [a] contract relating to the purchase or sale of goods, ... the prevailing party shall be allowed a reasonable attorney fee to be set by the court, to be taxed and collected as costs.


116
In McKee Brothers Ltd. v. Mesa Equipment, Inc., 102 Idaho 202, 203, 628 P.2d 1036, 1037 (1981), the Idaho court awarded attorney fees on appeal under this statute.


117
Federal courts must follow state law as to attorney fees in diversity actions.   See Interform Co. v. Mitchell, 575 F.2d 1270, 1280 (9th Cir.1978) (applying Idaho law).


118
Because we have concluded that the contract at issue is for the sale of goods, and as the City has substantially prevailed on these appeals, we hold that the City is entitled to its reasonable attorney fees on appeal under Idaho Code Sec. 12-120(2).  Because in any event it is necessary to remand, we request that the district court assess appropriate fees for the appeal.

CONCLUSION

119
We conclude that ancillary and pendent jurisdiction supported the City's third-party claims in the district court, and affirm the district court's jurisdictional ruling.  We also hold that the court did not abuse its discretion in retaining the case once the underlying federal action was settled.  We affirm the district court's holdings that the contract was not modified by the Pre-bid Submittal and guarantee letter, that the Uniform Commercial Code is applicable to the contract, and that attorney fees should be awarded the City under Idaho Code Sec. 12-120(2).


120
We hold, however, that the court's ruling that the contract provided the City with an exclusive remedy is erroneous.  We remand for a partial new trial to permit the City to seek its other remedies under the Idaho UCC.  We also vacate the district court's collateral source rule holding, and remand this issue for reconsideration during the partial new trial.  We further hold that the court did not abuse its discretion in denying the City's motion to amend its complaint to add punitive damages.


121
We hold that the district courts in this circuit have the discretion in exceptional cases to award expert witness fees in addition to the statutory $30 per day witness fee authorized by 28 U.S.C. Sec. 1821(b).  We remand so the district court may exercise its discretion consistent with this opinion.  We further hold that the court erred in refusing to award expert deposition costs.  On remand, absent manifest injustice, the district court should award both the City and Envirotech their reasonable expert witness fees incurred as a result of the opposing party's discovery depositions.  Finally, we award the City its costs and reasonable attorney fees on appeal as provided by Idaho statute, and request the district court to determine that award.


122
AFFIRMED IN PART, REVERSED AND REMANDED IN PART.



*
 Honorable Ben C. Duniway participated in the original panel in this case.  Upon his death, Honorable Mary M. Schroeder was drawn as his replacement


1
 Dewatering is the process of removing microscopic organisms known as sludge from waste water by the use of a vacuum filter


2
 BOD is a measure of the total amount of oxygen demanded from water by pollutants and microorganisms


