[¶ 1] Farm Credit of Maine appeals from a judgment entered in the Superior Court (Aroostook County, Pierson, J.) in favor of the Maine Farmers Exchange (MFX) on its setoff claim against Farm Credit’s security interest in Nightingale Enterprises, Inc.’s (NEI) account receivable representing proceeds from the sale of potatoes. MFX cross-appeals that part of the judgment denying MFX’s claim against Farm Credit for unjust enrichment. Farm Credit contends that the court erred in concluding that MFX had a right to a setoff pursuant to 11 M.R.S.A. § 9-818 (1995) because MFX’s interests in NEI’s account receivable was subject and inferior to Farm Credit’s rights as a secured creditor. We disagree and affirm the judgment.
[¶ 2] Farm Credit loaned approximately $735,000 to Gordon Wathen, Glendon Wathen, and Lynn Wathen, potato farmers, and to NEI, a corporation solely owned by Gordon Wathen, for the 1995-96 potato growing season. NEI leased equipment, bought potatoes from the Wathens, and then stored, packed, and resold the potatoes. Farm Credit secured the loan with a security interest in the potato crop and proceeds with the expectation that proceeds from the sale of the crop would be used to satisfy the loan.1 Farm Credit notified the buyers, shippers, and packers of potatoes of its security interest in the crops and inventory of NEI. The Wath-ens sold their crop to NEI in 1995-96, with the express condition that proceeds from NEI’s resale of the potatoes would be paid to Farm Credit.
[¶ 3] The security agreement required Farm Credit’s written authority prior to NEI selling the potatoes.2 In practice, however, only oral discussion took place between Farm Credit and NEI as to how NEI would market the crop and contract for the resale of the potatoes, and Farm Credit did not require NEI to get specific approval to sell the potatoes during the 1995-96 season. NEI sold most of its potatoes to MFX, a corporation in the *87business of buying and reselling potatoes. MFX was aware of Farm Credit’s security interest in the 1995-96 crop. The price that MFX paid was for bagged potatoes. MFX would pay NEI between thirty and forty days after taking delivery by checks made out jointly to Farm Credit and NEI.
[¶ 4] On February 1, 1996, MFX advanced $100,000 to NEI to allow NEI to take advantage of a favorable payment arrangement offered by the Maine Potato Growers, Inc. MFX and NEI agreed that NEI would make weekly payments to repay the loan by deducting the amount from what MFX owed NEI for future potato sales. NEI had the understanding that the $100,000 was not a loan, but rather an advance to NEI to be repaid from the future sale of the potatoes to MFX. The record is not clear as to the extent of Farm Credit’s knowledge of this financing agreement, and MFX acknowledged that these arrangements were made without Farm Credit’s direct involvement.
[¶ 5] By late 1995 and early 1996, both of NEI’s two bag vendors declined to extend further credit to NEI. MFX agreed to facilitate NEI’s purchase of bags from those same vendors by permitting NEI to charge the bags to MFX’s open account. MFX planned to deduct the amount due for the bags from each shipment invoice for the potatoes it received from NEI, At the request of NEI, however, MFX maintained the account for the bags separately and did not deduct the cost from NEI’s account, as long as NEI “[paid] for the bags in about the same manner that [they] would have made the deduction.” The agreement required MFX to pay NEI the total price for the bagged potatoes and NEI would then write MFX a check for the bags NEI purchased on MFX’s open accounts with the bag vendors.
[¶ 6] MFX also indicated that it “would always keep enough money in [NEI’s] ... potato account to deduct the [cost of the] bags, provided [NEI] didn’t pay for them.” MFX did not charge NEI more for the bags than NEI would have otherwise paid to the bag vendors.3 MFX became a creditor of NEI and maintained a separate book account for the bags provided to NEI. It is unclear whether Gordon Wathen informed Farm Credit about this arrangement.
[¶ 7] NEI did not make the bag payments to MFX and built up a large account payable due to MFX for the bags. MFX then agreed to keep a running account on the amount due for bag reimbursement and to deduct the payment from invoices at a later time in a similar fashion as it was doing for the $100,000 advance. MFX charged fourteen percent interest on the outstanding bag debt. MFX attached a summary of deductions to the joint checks it made out to NEI and Farm Credit, but NEI never forwarded the itemizations to Farm Credit.
[¶ 8] Farm Credit eventually became aware that NEI was not selling at a price sufficient to cover expenses. MFX appeared on every accounts payable list submitted to Farm Credit, and Farm Credit recognized, in the early spring of 1996, that MFX was becoming a substantial creditor of NEI. Farm Credit began adjusting the release price4 based on NEI’s *88accruing payables and the monthly financial summaries showing predictions for the remaining unsold crops. The credit arrangement between NEI and MFX, which allowed MFX to deduct from crop sale proceeds the value of the bags sold to NEI on MFX’s credit, prevented Farm Credit from calculating an accurate net value of the remaining crops.
[¶ 9] Farm Credit became concerned and discussed with Gordon Wathen the need to pay the accruing sums. Farm Credit witnesses at trial did not recall that they received an explanation as to the specifics of the accounts payable to MFX, or why they were increasing. Gordon Wathen also did not recall telling Farm Credit specifically about the need for the bags and the arrangement with MFX, but believed there was some discussion.
[¶ 10] NEI satisfied the $100,000 advance to MFX in May 1996, but requested that MFX wait to deduct money owed for the bags in order to assist NEI with its cash flow. MFX made its last crop purchase from NEI on May 29, 1996, and did not use its credit account to pay for more bags after April 1, 1996. MFX set off from its June 7,1996, payment to NEI and Farm Credit for the purchase of the potatoes the $92,270.59 that NEI owed MFX (including accrued interest) for the bags that NEI bought on MFX’s credit.
[¶ 11] NEI and the Wathens commenced bankruptcy proceedings in July of 1996. Farm Credit received relief from the automatic stay in order to pursue a claim, as a secured lender, against MFX for the sums that MFX had set off.5 MFX filed a complaint with the Bankruptcy Court seeking a declaratory judgment regarding its rights and claiming priority for its setoff from what it owed to NEI. Following the transfer of the case to the Superior Court, Farm Credit filed a counterclaim, asserting that its security interest gave it priority over MFX’s claim, and prayed that the court hold MFX liable for crop sale proceeds and for punitive damages.
[¶ 12] The Superior Court found that MFX’s setoff claim arose out of its potato contract with NEI, and, relying on 11 M.R.S.A. § 9-318, concluded that Farm Credit’s security interest was subject to the setoff claim of MFX. The court entered a judgment in favor of MFX on its setoff claim in the amount of $92,270.59. Farm Credit appealed, and MFX appealed the court’s ruling that MFX had not met its burden to prove the elements necessary to make out a claim for unjust enrichment.6
[¶ 13] Title 11 M.R.S.A. § 9-318 provides a limited right to a setoff for a party in the position of MFX, a right that can be superior to the security interest of a secured party in the position of Farm Credit, if the subject matter of the setoff arises out of and is part of a contract between an account debtor and assignee.7 The statute provides:
*89Unless an account debtor has made an enforceable agreement not to assert defenses or claims arising out of a sale as provided in section 9-206, the rights of an assignee are subject to
(a) All the terms of the contract between the account debtor and assignor and any defense or claim arising therefrom; and
(b) Any other defense or claim of the account debtor against the assignor which accrues before the account debtor receives notification of the assignment.
11 M.R.S.A. § 9-318(1) (1995).
[¶ 14] The Superior Court correctly applied the terminology used in section 9-318 to the potato contract between MFX and NEI, and identified MFX as an account debtor (from its purchase of potatoes for which it has not paid), NEI as an assignor (from the assignment of its right of payment for the sale of potatoes), and Farm Credit as an assignee (from the assignment to it of the right to receive payment for the sale of the potatoes).8 Under section 9-318(l)(a),9 Farm Credit’s security interest was subject to “[a]ll the terms of the contract between the account debtor [MFX] and the assignor [NEI] and any defense or claim arising therefrom.” Farm Credit’s rights as assignee in this case, however, would be subject only to the terms of a single contract for the sale of potatoes between NEI and MFX, but not to the terms of contracts separate from that single contract. See Harris v. Dial Corp., 954 F.2d 990, 993 (4th Cir.1992) (stating only single contract brings setoff claim within protection of Article 9).
[¶ 15] The issue presented to the Superior Court was whether the agreement to allow NEI to purchase bags on MFX’s account was part of the potato contract, or was a separate agreement. If it was a separate contract, Farm Credit’s security agreement would not be subject to it, and MFX’s rights would be inferior to Farm Credit’s security interest. Because MFX was aware of Farm Credit’s security interest in the potatoes, it was MFX’s burden to show that its right to a setoff arose pursuant to section 9-318(l)(a). In order to succeed, MFX had to prove that its agreement to advance credit to NEI for the bags arose out of and was part of the contract with NEI to buy and sell potatoes. See In re Apex Oil Co., 975 F.2d 1365, 1368, 1370 (8th Cir.1992). The court found in favor of MFX, reasoning that the credit for bag purchases agreement did arise out of and was part of the potato contract between NEI and MFX. Accordingly, the court concluded that, pursuant to section 9-318, the rights of Farm Credit as the assignee were subject to all the terms of the potato contract between NEI and MFX, including that part of the agreement for the purchase of bags, and that MFX properly offset the costs for the bags from the monies it owed to NEI.
[¶ 16] The intent of the parties and the expectation of performance are crucial to determining whether a single *90contract or separate contracts exist. Robbins v. State Tax Assessor, 536 A.2d 1127, 1129 (Me.1988) (reviewing intent of parties to interpret contract); RESTATEMENT (SECOND) OF CONTRACTS § 240 cmt. b (1981);10 see also Carvel Co. v. Spencer Press, Inc., 1998 ME 74, ¶10, 708 A.2d 1033, 1035 (reviewing severability or entirety of contract for clear error). A determination by a court relating to the contractual intent of the parties is a question of fact, and we review such a finding for clear error. See Forrest Assoc. v. Passamaquoddy Tribe, 2000 ME 195, ¶ 9, 760 A.2d 1041, 1044; Carvel Co., 1998 ME 74, ¶ 10, 708 A.2d at 1035; Ludington v. La-Freniere, 1998 ME 17, ¶ 5, 704 A.2d 875, 877; Dehahn v. Innes, 356 A.2d 711, 716-17 (Me.1976). Accordingly, we will defer to a trial court’s findings of fact unless such findings are clearly erroneous. In re Estate McCormick, 2001 ME 24, ¶ 18, 765 A.2d 552, 559; Paffhausen v. Balano, 1999 ME 169, ¶ 11, 740 A.2d 981, 983 (relying on competent evidence in record to affirm trial court’s findings); Estate of Plummer, 666 A.2d 116, 118 (Me.1995) (deferring to lower court’s finding that preemptive right was reasonable); Blackmer v. Williams, 437 A.2d 858, 863 (Me.1981) (acknowledging trial court’s superior capability of determining credibility of witnesses and resolving conflicts in testimony); Porges v. Reid, 423 A.2d 542, 544 (Me.1980) (giving considerable deference to presiding justice’s set aside of default because of familiarity with case and superior position to evaluate credibility of parties). Our function as an appellate court is not to “review a cold transcript and draw [our] own factual inferences” but to determine whether the record contains competence evidence to support the trial court’s factual conclusions. Sturtevant v. Town of Winthrop, 1999 ME 84, ¶ 9, 732 A.2d 264, 267 (citation omitted).
[¶ 17] The court found that the evidence “establishes that the intent of the agreement between MFX and NEI was for the packaging and selling of NEI’s potatoes for the 1995-96 season.... NEI was obligated to sell MFX its potatoes to repay the $100,000 loan. When NEI could not obtain potato bags, MFX was indirectly obligated to allow NEI to charge the bags to MFX’s account if it wanted to have the $100,000 advance repaid out of the future potato sales from NEI.” There is competent evidence in the record to support that finding, and we discern no clear misapprehension of the significance of the evidence. It is common practice in the industry for the grower or seller of potatoes to provide bags in the sale of potatoes, and such was the case with the contract between NEI and MFX. The parties intended NEI’s provision of the bags to be an integral part of their original potato contract. Allowing NEI to charge MFX’s account for the bags resulted in NEI being able to fulfill the contract according to its original terms, MFX also originally suggested handling the money NEI owed for the bags as a deduction in the amount MFX owed NEI for the potatoes. Accordingly, we find no clear error in the finding of the court that the agreement to supply credit for the purchase of bags was an integral part of a *91single contract. See Carvel Co., 1998 ME 74, ¶ 10, 708 A.2d at 1035.
[¶ 18] Farm Credit contends that the bag agreement between NEI and MFX was a separate contract because NEI was not required to purchase the bags from MFX and NEI used the bags to supply some orders to other buyers. The purchase of potatoes by MFX from NEI, however, was an ongoing contractual relationship that occurred before the open account system for the bags was initiated. Although NEI may have found alternative ways to acquire the bags, it was necessary for NEI to get the bags quickly to fulfill its obligation to sell bagged potatoes to MFX. Moreover, although some of the bags purchased through MFX’s credit account were used by NEI for buyers other than MFX, that use was minimal. Nor does the fact that NEI originally wanted to keep a separate account for the bags and to pay for them by check mandate a finding that the bag agreement was a wholly separate contract.
[¶ 19] Farm Credit’s contention that the open account arrangement was made prior to subsequent crop purchases by MFX also does not require a conclusion that the trial court erred. Regardless of when they accrue, claims and defenses arising out of a contract from which assigned accounts are created may be asserted by the account debtor as offsets against the amount owed to the assignee. United Cal. Bank v. E. Mountain Sports, 546 F.Supp. 945, 963, 977 (D.Mass.1982) (declaring running account part of single contract even for claims based on unrelated transactions because that result consistent with course of dealing between assignor and account debtor).
[¶20] This case is similar to Harris v. Dial Corp., 954 F.2d 990 (4th Cir.1992), where the court found that one contract covered both the sale of resin by a bottle purchaser to a bottle manufacturer and the sale of the bottles by the bottle manufacturer to the bottle purchaser. The court subsequently allowed the amounts owed by the purchaser for the purchase of bottles to be offset against amounts owed by the bottle manufacturer for the purchase of resin. Id. at 993. Resin was necessary for the manufacturer of the bottles, and the purchaser supplied the manufacturer with the required resin when the manufacturer could not obtain the resin itself. Id. The court specifically found that the resin agreement was “inseparable from the bottle agreement because [the manufacturer] could not have made the bottles without the resin, and it could not get the resin except from [the purchaser].” Id. (reviewing divisibility of contract as matter of law).
[¶ 21] Although the court could have concluded that the credit arrangement for the bags was separate from the contract to sell potatoes, we cannot say that the court erred in its factual conclusion that that agreement arose out of and was part of the contract for the sale of potatoes. See Paffhausen, 1999 ME 169, ¶ 11, 740 A.2d at 983 (refusing to vacate lower court finding simply because court could reach different conclusion).
[¶ 22] Because we uphold the Superior Court’s conclusion that MFX had a right to the setoff pursuant to 11 M.R.S.A. 9-318(1), we need not address MFX’s contention that MFX took the potatoes it purchased from NEI free and clear of any security interest of Farm Credit. See 11 M.R.S.A. §§ 9-306(2), 307(1) (1995 & Supp.2001) repealed by P.L.1999, ch. 699, § A-l (effective July 1, 2001). Nor need we decide whether the trial court erred when it concluded that Farm Credit was not unjustly enriched by MFX’s extension of credit to NEI, which allowed NEI to continue to fulfill its potato contract and *92thus continue to pay down its loan to Farm Credit. See Forrest Assoc., 2000 ME 195, ¶ 14, 760 A.2d at 1045^6.
The entry is:
Judgment affirmed.
. A crop loan is one made with the specific intent that the loan money be used to plant, harvest, store, and sell the fruit of the crops.
. The security agreement provides:
It is understood that the use of the terms “proceeds”, "substitutions”, "replacements”, "accessions” and “additions” does not give the Debtor authority, express or implied, to sell or otherwise dispose of the Collateral, unless Debtor is hereafter specifically authorized to do so. The within grant of a security interest is in addition to and supplemental of any security interest previously or herewith granted by the Debt- or to the Secured Party.
Another portion of the agreement states that:
Without prior written consent of Farm Credit: (1) Debtor will not sell, lease, transfer, assign or otherwise dispose of any of the Collateral, nor permit any liens, security interests or encumbrances to attach to any of the Collateral, except in favor of Secured Party; and (2) Debtor will not remove any of the Collateral or books and records pertaining thereto from the location(s) specified in Section (1) above.
. An employee of NEI testified that NEI received more for the potatoes they sold bagged than they would have received for potatoes sold in bulk. It was common practice in the industry for potato growers to be responsible for providing bags to pack the potatoes for shipment.
. A release price is the minimum amount which must be paid to a crop lender from each crop sale proceeds check to ensure satisfaction of the crop loan.
. The money Farm Credit claims it was due from NEI at the time of trial was between $138,000 and $165,863.80.
. The law permits recovery for the value of a benefit retained when there is no contractual relationship if fairness and justice compel performance of a legal and moral duty to pay. Forrest Assoc. v. Passamaquoddy Tribe, 2000 ME 195, ¶ 14, 760 A.2d 1041, 1046. To sustain a claim for unjust enrichment, MFX must show that (1) it conferred a benefit on Farm Credit, (2) Farm Credit had an appreciation or knowledge of the benefit, and (3) the benefit was under such circumstances to make it inequitable for Farm Credit to retain the benefit without payment of its value. See id. at ¶ 14, 760'A.2d at 1045-46.
The court did not find that Farm Credit appreciated or had knowledge of the benefit, the second prong of the test required to sustain an unjust enrichment claim.
.Even though Article 9 usually refers to a creditor with a security interest as a "secured party,” a secured party with a security inter*89est in accounts is the "assignee” under section 9-318. See In re Otha C. Jean & Assoc. Inc., 152 B.R. 219, 222-23 (E.D.Tenn.1993) (noting that "courts have generally applied § 9-318 this way.”)
. Section 9-318(1) provides a creditor with a limited right to a setoff relating to a perfected security interest. 11 M.R.S.A. § 9-318(1) (1995); see also In re Otha C. Jean, 152 B.R. at 222 (explaining applicability of Article 9 to setoff); Harris v. Dial Corp., 954 F.2d 990, 993 (4th Cir.1992) (only single contract brings setoff claim within protection of Article 9); In re Apex Oil Co., 975 F.2d 1365, 1368 (8th Cir.1992) (noting applicability of Article 9).
. Because MFX had notice of the assignment from NEI to Farm Credit, section 9 — 318(l)(b) does not apply.
. Separate contract are discussed in a comment to section 240:
If there are two separate contracts, one party’s performance under the first and the other party’s performance under the second are not to be exchanged under a single exchange of promises, and even a total failure of performance by one party as to the first has no necessary effect on the other party’s duty to perform the second.... This is not so, however, if there is a single contract under which the parties are to exchange performances ....
Restatement (Second) of Contracts § 240 cmt. b (1981).