This is a diversity action brought by appellant Balzer/Wolf Associates, Inc. (Bal-zer/Wolf) against appellee Parlex Corporation (Parlex) for damages resulting from an alleged breach by Parlex of an implied covenant of good faith and fair dealing arising from a Sales Representative Agreement between Balzer/Wolf and Parlex. The district court granted summary judgment for Parlex. Balzer/Wolf appeals and we affirm.
I.
THE PLEADINGS AND MOTIONS FOR SUMMARY JUDGMENT
Balzer/Wolf alleged in its complaint that it entered into a Sales Representative Agreement with Parlex in which Bal-*772zer/Wolf was to be paid a commission of six percent on sales made pursuant to the Agreement. This Agreement provided that either Balzer/Wolf or Parlex could terminate the agreement without cause by notice no less than sixty days prior to the termination date. In the event of termination, the Agreement included a schedule to determine the amount of commissions payable on orders accepted by Parlex prior to termination but delivered thereafter. The termination article is set forth in the margin.1
The complaint further alleged that Par-lex gave notice of termination of the Agreement on May 9, 1980 and that the termination was effective July 8, 1980. Balzer/Wolf further alleges that Hughes Aircraft made purchases from Parlex of a product known as “Flexilayer” commencing in December, 1979, continuing during the first six months of 1980, and up to the date of the complaint, February 9, 1982. Balzer/Wolf acknowledged in the complaint that it had been compensated pursuant to the Agreement with respect to all those orders placed by Hughes Aircraft prior to July 1, 1980. No compensation for orders placed subsequent to July 1, 1980 has been paid to Balzer/Wolf. The failure to pay commissions on such orders, Bal-zer/Wolf alleges, violates an implied covenant of good faith and fair dealing to which Balzer/Wolf alleges Parlex was bound by reason of Massachusetts law, the applicable law specified in the Agreement. It is further alleged that the orders placed after termination resulted from the sales efforts of Balzer/Wolf before termination, and that Parlex intentionally terminated the Agreement to avoid paying commissions on orders placed after termination. Bal-zer/Wolf does not allege, however, that it is entitled under the explicit terms of the Agreement to any commissions that it has not been paid. A second claim in quantum meruit is joined to the principal claim outlined above.
Parlex’s answer to the Balzer/Wolf complaint alleges primarily that Parlex has paid Balzer/Wolf all that Balzer/Wolf is entitled to under the Agreement. Secondarily Parlex alleges that Balzer/Wolf’s sales effort did not contribute to the orders with respect to which Balzer/Wolf was paid no commissions.
In due course Parlex moved for summary judgment dismissing the complaint in its entirety with prejudice. Parlex alleged that under the circumstances of this case there exists under Massachusetts law no implied covenant of good faith and fair dealing applicable to the exercise of the *773power of termination. Balzer/Wolf responded and, after a full description of the circumstances of the case, asserted that there were genuine issues of material fact and that a trial by jury should be ordered. As already indicated, the district court granted the motion of Parlex and entered judgment accordingly.
II.
DISCUSSION
The lines between contracts, restitution, and torts are less distinct in cases such as this than ordinarily they are. Approached as an issue of tort, the question is whether the plaintiff was deprived wrongfully of a right to the commissions arising from the purchases by Hughes Aircraft from Parlex. Under this approach the contract between Balzer/Wolf and Parlex is but the source from which the duty of Parlex springs. The scope of that duty would reside largely in the hands of a judge, guided by precedent, and a properly instructed jury.
Approached by way of quantum meruit, or restitution, analysis would focus on whether Balzer/Wolf, acting not as a volunteer, conferred a benefit on Parlex, the retention of which without payment would be unjust. This analysis presents mixed law and fact issues, the resolution of which, like the tort approach, probably would require the involvement of both judge and jury.
Approached via the law of contract, the focus is upon the manifested intent of the parties. As applied to the facts of this case, the question is whether Parlex and Balzer/Wolf manifested an intent to provide for the contingency that generated this dispute. Should that question, in the opinion of the judge, unambiguously be capable of an affirmative answer, the issue then becomes whether the intended provision contravenes some public policy and, if so, the consequences of that contravention. Should the question be incapable of an unambiguous affirmative answer, the issue then becomes what provision must be implied either in fact or in law to deal with the contingency. At this point tort, restitution, and contract analysis, while not merging, travel on nearly adjacent roads through similar country.
Balzer/Wolf s theory of this case primarily embraces the contract analysis, as indeed it must because to some extent the written contract between Balzer/Wolf and Parlex provides for the payment of commissions subsequent to termination. Bal-zer/Wolf does not attack the termination clause as either unconscionable or illegal. However, the contract does not, Bal-zer/Wolf asserts, deal with commissions arising from circumstances such as surrounded the Hughes Aircraft orders at issue here. Thus, it is necessary, Bal-zer/Wolf continues, to imply a covenant of good faith and fair dealing for which ample authority under Massachusetts lav/ exists. See Fortune v. National Cash Register Co., 373 Mass. 96, 364 N.E.2d 1251 (1977). The scope of the asserted covenant of good faith and fair dealing is somewhat imprecise, but it is Balzer/Wolf s position that, whatever its dimensions, it embraces a duty to pay full commissions on all orders of a product called “Flexilayer” placed by Hughes Aircraft both before and after termination of the contract.
Parlex rejects the assertion by Bal-zer/Wolf that the contract does not deal with the Hughes Aircraft orders. Parlex’s position is that the contract deals with those orders as it dealt with orders placed by other purchasers about which Bal-zer/Wolf is not concerned.
Parlex insists that the contract makes no distinction between Hughes Aircraft orders and orders by others, nor does the contract distinguish between those to whose generation Balzer/Wolf contributed substantially and those to whose generation it did not. The contract therefore should be enforced according to its terms, according to Parlex. Parlex also insists that in any event Massachusetts law implies a covenant of good faith and fair dealing only with respect to employment contracts, a position that the district court substantially adopted.
*774Interpretation of the law of a state, particularly one as distant as Massachusetts, by a federal court is an enterprise fraught with the possibility of error. Although keenly aware of such risks, we do not read the Massachusetts law to limit to employment contracts implied covenants of good faith and fair dealing. We see no bright line in Massachusetts law that separates employment contracts from other types of contracts. Fortune held that an implied covenant of good faith and fair dealing is present in all contracts. See 373 Mass, at 102, 104, 364 N.E.2d at 1256-57. An implied covenant has been employed in a dispute in which the party that was terminated allegedly to avoid paying commissions was a corporation. See RLM Assocs., Inc. v. Carter Mfg. Corp., 356 Mass. 718, 248 N.E.2d 646 (1969). See also Fortune, 373 Mass, at 103, 364 N.E.2d at 1256 (collecting implied covenant cases).
Fortune, however, did not involve a situation in which the implied covenant overrode an express provision in the contract applicable to the manner in which commissions would be paid on orders accepted before termination. The contract in Fortune, described by the court as set forth in the margin,2 governed the salesman’s right to commissions independently of termination. Indeed, the contract’s primary focus would appear to be on circumstances unrelated to termination. Although The Fortune court found that the loss of commission rights “if shipment of the order was not made within eighteen months from the date of the order” did apply to orders taken before termination that were delivered both after termination and eighteen or more months after the order date, that interpretation was not explicitly required by the contract. In this case, however, Bal-zer/Wolf and Parlex have explicitly provided for the contingency of termination. This was not true in Fortune.
We also believe that Massachusetts courts would recognize that the conduct of Parlex is substantially less subject to censure than was that of the employer in Fortune, who abused the employee by retaining his services for a period of eighteen months after termination while arranging to deprive him of commissions on orders originating in his territory. No such abuse is present in this case. The power to terminate subject to the duties explicitly set forth was incorporated in an agreement in which neither Parlex nor Balzer/Wolf can be said to have overreached the other. We are encouraged by Gerald Rosen Co., Inc. v. International Telephone & Telegraph Co., 16 Mass.App. 929, 450 N.E.2d 189 (1983), to believe that Massachusetts would recognize that Fortune does not control this case.
It comes to this. We agree with the first proposition on which Parlex relies. That is, without regard to whether Massachusetts law implies a covenant of good faith and fair dealing in contracts other than employment, we hold that the contract unambiguously provides for the contingency that gives rise to this case and that, in the absence of unconscionability or illegality, Massachusetts law requires the enforcement of the contract as written. See Zarum v. Brass Mill Materials Corp., 334 Mass. 81, 85, 134 N.E.2d 141, 143 (1956); Brown v. Fales, 139 Mass. 21, 28, 29 N.E. 211 (1885). The bargain as struck should be enforced. Only by doing so can we be *775certain that the balance of advantages and disadvantages struck by each party in the bargain they reached is implemented. Not to implement this balance would deprive the parties of their bargain and impair their freedom to contract as they wish.
Bargains, of course, sometimes rest on assumptions about the future that prove to be fundamentally incorrect. In those instances relief derived from principles not imbedded in the language of the contract, such as impossibility of performance, commercial frustration, or implied covenants, is available. In effect, Balzer/Wolf insists this is such a case. We disagree. While it cannot be said that the parties foresaw the Hughes Aircraft orders, it is clear they foresaw the type of situation of which the Hughes Aircraft orders is an example. Perfect foresight is not required to assure enforcement of the written word. A general provision which deals with the type of situation which does in fact occur should be enough. Clearly and unambiguously the parties here agreed to that much.
AFFIRMED.
. IX. TERMINATION
This Agreement shall be in full force and effect commencing with the effective date specified herein and shall continue in full force and effect until terminated by written notice in accordance with the following schedule:
(1) Either party may terminate this Agreement with or without cause by notice to the other party as follows:
(a) Not less than thirty (30) days prior to the termination date during the first eighteen (18) months of this Agreement; or
(b) Not less than sixty (60) days prior to the termination date after the first eighteen months of this agreement.
(2) PARLEX may terminate this Agreement for cause by notice to the other and, if the notice so states, such termination shall be effective as of the date of the default constituting cause.
(3) PARLEX may terminate this Agreement forthwith by notice in the event that REPRESENTATIVE shall become insolvent or shall be determined a bankrupt under any applicable law or regulation, or shall enter into a composition for the benefit of its creditors, or shall otherwise be in such financial condition, as in PARLEX’S opinion, to jeopardize its proper function under this AGREEMENT.
After any such termination date, the REPRESENTATIVE shall be under no further obligation to PARLEX, and PARLEX shall be under no further obligation to the REPRESENTATIVE, except that PARLEX shall pay commissions earned on any order within the terms of the Agreement which was accepted by PARLEX prior to the time of termination, in accordance with the following schedule:
(1) Full commission for orders delivered during the first six (6) months after termination date;
(2) One-half QA) commission for orders delivered during the seventh (7th) through the twelfth (12th) months after termination date; and
(3) No commission for orders delivered after twelve (12) months following termination date.
. The amount of the bonus was determined on the basis of "bonus credits,” which were computed as a percentage of the price of products sold. Fortune would be paid a percentage of the applicable bonus credit as follows: (1) 75% if the territory was assigned to him at the date of the order, (2) 25% if the territory was assigned to him at the date of delivery and installation, or (3) 100% if the territory was assigned to him at both times. The contract further provided that the "bonus interest” would terminate if shipment of the order was not made within eighteen months from the date of the order unless (1) the territory was assigned to him for coverage at the date of delivery and installation, or (2) special engineering was required to fulfill the contract. In addition, NCR reserved the right to sell products in the salesman’s territory without paying a bonus. However, this right could be exercised only on written notice.
Fortune v. National Cash Register Co., 373 Mass. 96, 97-8; 364 N.E.2d 1251, 1253 (1977).