
531 P.2d 1370 (1975)
MID-CONTINENT CASUALTY COMPANY, a corporation, Appellee,
v.
FIRST NATIONAL BANK & TRUST COMPANY OF CHICKASHA, Oklahoma, a National Banking Corporation, Appellant.
No. 42325.
Supreme Court of Oklahoma.
February 11, 1975.
C.J. Watts, Watts, Looney, Nichols & Johnson, Oklahoma City, for appellee.
Loyd Benefield, Wayne B. Snow, Savage, Gibson, Benefield & Shelton, Oklahoma City, Robert B. Parks, Chickasha, for appellant.
*1371 IRWIN, Justice:
A contractor and a property owner entered into a contract to construct certain improvements. The contractor became financially unable to pay the claims of materialmen. A dispute arose between First National Bank & Trust Company of Chickasha (appellant), which loaned money to the contractor and took an assignment of part of the contract earnings, and the contractor's surety, Mid-Continent Casualty Company (appellee), who paid the claims of materialmen and took assignments of their rights. The bank and surety both claim superior right and title to money withheld by the property owner which was due and payable on completion of the contract.
The trial court determined the subrogated rights of the surety to be superior to the assignment rights of the bank and rendered judgment in favor of surety. The bank appealed.
The record discloses that M.T. Shelton, d/b/a Shelton Construction Company (Shelton), entered into a contract with The Tipton Home (Tipton) to construct dining hall facilities for Tipton for $211,500.00. This was a "private works contract" and did not come within the meaning of a "public improvement contract" as that term is used in 61 O.S. 1971, § 1 and § 2.
At the request of Shelton and pursuant to the provisions of his contract with Tipton, Shelton as principal, and Mid-Continent as surety, executed and delivered to Tipton, as obligee, two construction bonds covering the contract, one of which was a performance bond and the other a labor and material bond.
A part consideration for Mid-Continent Casualty Company (Surety) to become a surety on the above bonds, Shelton executed in favor of Surety a General Application and Agreement of Indemnity. This agreement consists of an assignment to *1372 Surety of the contract earnings Shelton was to receive on the Tipton contract and was conditioned to take effect upon breach of the contract, bond, or terms of the agreement. Surety made no filings under the provisions of the Uniform Commercial Code. (12A O.S. 1971)
During construction, the First National Bank (Bank) loaned Shelton $20,465.00, which he used on the Tipton contract and other projects. As a part of this loan transaction, Shelton executed a note in favor of Bank and a security agreement covering part of the proceeds to become due under the Shelton-Tipton contract. Bank perfected its security interest under the provisions of the Uniform Commercial Code. At the time it made the loan to Shelton, Bank was aware that Shelton had obtained construction bonds and was bonded on the contract.
Shelton completed the construction work but was unable to pay all the materialmen. Shelton advised Surety of his financial difficulties. Shelton and Surety requested Tipton to withhold any further payments. Tipton at that time had $24,900.00 of the contract funds that Shelton was entitled to receive when all claims had been paid. Surety paid $33,400.00 in claims to the materialmen.
Each of the materialmen so paid executed in favor of Surety an assignment of all his right, title and interest in and to his claim or claims against Shelton and Tipton, to the extent of the payment made to them by Surety, together with all rights, including liens, legal or equitable, that he had.
At the time Surety paid the claims of the materialmen and took their assignments, none of the materialmen had filed their liens and the time for filing them had expired.
The issue presented to the trial court and this Court on appeal is whether Surety or Bank had superior rights to the funds withheld by Tipton. After Surety commenced this action Tipton tendered the funds into court.
The first issue presented concerns Bank's filing of its assignment from Shelton under the Uniform Commercial Code and Surety's failure to file its security agreement.
Bank contends that the Code procedure for protecting security interests is applicable to its assignment and to Surety's security agreement. Bank reasons that since it perfected its security interest under the Code and Surety did not, its rights to the funds withheld by Tipton and tendered into court, are superior to Surety's rights under the Code.
Surety contends that by statute and by subrogation, its rights are superior to those of Bank, and its failure to file under the Code does not affect those rights.
The first issue to be determined is to what extent, if any, is the equitable doctrine of subrogation modified or affected by the Uniform Commercial Code. Stated in another way, are the rights of Bank and Surety to the funds withheld by Tipton determined by the Code, or has the equitable doctrine of subrogation survived the adoption of the Code and Surety is entitled to invoke the doctrine of subrogation notwithstanding the Code?
Our sister State of Kansas in United States Fidelity and Guaranty Company v. First State Bank of Salina, 208 Kan. 738, 494 P.2d 1149 (1972), after discussing certain provisions of the Code held that subrogation rights are not "security interests" under the Uniform Commercial Code, and a contractor's surety is not required to file financing statements under the Code to preserve such rights or to preserve the priorities he would otherwise enjoy. The Kansas Court also held that the right of legal or equitable subrogation arises by operation of law and does not depend upon contract, assignment or agreement.
Other courts have been called upon to determine whether the equitable doctrine of subrogation has been abrogated, modified, affected or abridged by the adoption of the Uniform Commercial Code.
*1373 In French Lumber Co. v. Commercial Realty & Finance Co., 346 Mass. 716, 195 N.E.2d 507 (1964), the Supreme Judicial Council of Massachusetts said that no provision of the Uniform Commercial Code purports to affect the fundamental equitable doctrine of subrogation. In Jacobs v. Northeastern Corporation, 416 Pa. 417, 206 A.2d 49 (1965), the Supreme Court of Pennsylvania held that subrogation rights are not "security interests" within the meaning of the Uniform Commercial Code.
In National Shawmut Bank of Boston v. New Amsterdam Cas. Co., 1 Cir., 411 F.2d 843 (1969), the Court of Appeals for the First Circuit discussed in detail the concepts of subrogation and the provisions of the Code. Noting that some law review comments advocate a liberal application of the Code to the surety's interest (Comments, 6 B.C.Ind. & Comm.L.R. 798 (1965) Note, 4 B.C.Ind. & Comm.L.R. 752 (1963) Note, 65 Col.L.Rev. 927 (1965), the federal appellate court determined that the equitable doctrine of subrogation stands unaffected by the Code and survives its passage.
In Home Indemnity Company v. The United States, 433 F.2d 764, 193 Ct.Cl. 266 (1970), the United States Court of Claims construed the Illinois Uniform Commercial Code and held that the Code did not alter the preexisting law as to surety's right of subrogation. In In Re J.V. Gleason Co., 452 F.2d 1219 (1971), the Court of Appeals for the Eighth Circuit, held that the equitable subrogaton claim of surety, which, after contractor defaulted, completed performance on contracts and paid claims of labor and materialmen, did not constitute a "security interest" under Minnesota Uniform Commercial Code, and was not required to be filed in order to be superior to the claim of a trustee in bankruptcy.
In Gleason the Court said:
"It should be noted that one of the express purposes and policies underlying the Code is `to make uniform the law among the various jurisdictions.' § 1-102(2)(c). This purpose would be ill-served if we were to hold for the trustee. All of the still viable decisions hold that the doctrine of equitable subrogation in suretyship cases has not been affected by the adoption of the Code. Jacobs v. Northeastern Corp., 416 Pa. 417, 429, 206 A.2d 49, 55 (1965); National Sur. Corp. v. State National Bank, 454 S.W.2d 354 (Ky. 1970); Aetna Cas. & Sur. Co. v. Perrotta, 62 Misc.2d 252, 308 N.Y.S.2d 613 (1969); French Lumber Col, Inc. v. Commercial Realty & Finance Co., Inc., 346 Mass. 716, 195 N.E.2d 507 (1964); Canter v. Schlager, 358 Mass. 789, 267 N.E.2d 492 (1971); National Shawmut Bank of Boston v. New Amsterdam Cas. Co., Inc., 411 F.2d 843 (1st Cir. 1969) (applying Mass. law); American Fire & Cas. Co. v. First National City Bank of New York, 411 F.2d 755 (1st Cir.1969) (Puerto Rico); Framingham Trust Co. v. Gould-National Batteries, Inc., 427 F.2d 856 (1st Cir.1970) (applying Mass. law); Home Indemnity Co. v. United States, 433 F.2d 764, 193 Ct.Cl. 266 (1970) (applying Ill. law)."
In view of one of the express purposes and policies underlying the Code is "to make uniform the law among the various jurisdictions"; and in view of the still viable and persuasive decisions heretofore set out; and in view of our own decisional law hereinafter discussed, concerning the equitable doctrine of subrogation; it would require a strained construction of the Code by this Court to hold that the equitable doctrine of subrogation has been displaced by the Code.
We hold our Uniform Commercial Code does not abrogate, modify, affect or abridge the equitable doctrine of subrogation, and Surety was not required to file under the Code to preserve its priority under the equitable right of subrogation.
We will now consider if the subrogated rights of Surety are superior to the assignment rights of Bank. In considering this issue we are at once faced with the fact that Surety is seeking to invoke here the equitable doctrine of subrogation in a "private *1374 works" contract as distinguished from a "public works" contract.
Bank contends that (a) since the subcontractors failed to file their liens and (b) since the time for filing them had expired at the time Surety paid their claims, the subcontractors must be treated as general creditors of Shelton at the time of their assignments to Surety. Bank takes the position that the assignments of claims to Surety by the subcontractors created no additional rights in Surety that subcontractors did not have and that its perfected security interest was superior to the subcontractor's rights and the assignment rights of Surety.
Bank's argument necessarily presupposes that Surety's rights of subrogation flow entirely from the subcontractors whose claims were paid and no additional equities may attach to Surety under the doctrine of subrogation through Tipton, the owner. As will be hereinafter shown, had the Shelton-Tipton contract been a "public works" contract, Surety would be subrogated to the rights of Tipton and would have in the funds retained by Tipton an equity superior to the rights of Bank.
The rights of a performing surety in a public works contract are delineated in Fidelity National Bank of Oklahoma City v. United States Casualty Co. (1942), 191 Okl. 496, 131 P.2d 75. Smith, a contractor, entered into a construction contract with the State Highway Commission. Smith was unable to pay some of the claims for materials furnished and the surety on the contract paid the claims. The State Highway Commission had retained part of the contract funds.
During construction, Smith had obtained a loan from Fidelity National Bank and as security executed to Fidelity an assignment of all funds accruing to Smith under the contract. The issue presented was whether Fidelity or the surety was entitled to the retainage fund held by the State Highway Commission. In determining the surety was entitled to the retainage funds to the extent of the claims it had paid, we held:
"A highway contractor's surety, paying claims of materialmen and taking assignments of their claims, became subrogated to the rights of the materialmen.
"A surety on the bond of a public contractor conditioned in compliance with 61 Okl.St.Ann. § 1, (§ 10983, O.S. 1931) for the payment of all indebtedness incurred for labor and material furnished in the construction of a public improvement under a contract with the state, has an equity, under the doctrine of subrogation, in money retained by the State under the authority of its contract for said public improvement, for the payment of laborers and materialmen, which equity is superior to the claim of a bank lending money to the contractor for the prosecution of the work and taking an assignment of all moneys to become due under the contract." (Emphasis ours)
In Standard Acc. Ins. Co. v. The Fed. Nat'l Bank (10 Cir.1940), 112 F.2d 692, 115 F.2d 34, Joyce (the contractor), had made an assignment to Federal under a state highway construction project. Joyce was in default and Standard (the surety) completed the contract. In that case we said:
"On completion of the construction contract and the payment of claims for labor and materials by Standard, it was subrogated to all the securities and remedies which the Commission was capable of asserting against Joyce.
"Where a surety of a construction contractor, upon the contractor's default, completes the contract, and the contractee has funds in his hands earned by the contractor, the surety is entitled to be subrogated to the rights which the contractee, upon the contractor's default, could assert against such funds, to the extent necessary to reimburse the surety for the outlay made to complete the contract. This right to the funds embraces not only retained percentages, but other funds earned by the contractor remaining in the hands of the contractee. It extends to any earned funds held by the *1375 contractee because, on default by the contractor, the contractee upon completion of the contract itself, could recoup its loss from any funds in its hands earned by the contractor.
"While the breach by Joyce was subsequent to the assignment to the Bank and notice thereof to the Commission, the right to claim damages for breach of the contract existed at the time the contract was made and the Commission would have been entitled, as against the Bank, to withhold the funds in its hands, earned by Joyce, to recoup the state's loss." (Emphasis ours)
Under the Shelton-Tipton contract here under consideration, contract funds could be withheld to protect Tipton from loss on account of Shelton's failure to make payments to subcontractors or for material or labor.
The labor and material payment bond under which Surety was required to pay the subcontractors was made "for the use and benefit of claimants" (the subcontractors). By the terms of this payment bond, the subcontractors were not required to perfect their liens in order to be entitled to proceed against Surety on its bond. In short, Surety's obligation to the subcontractors stood entirely unimpaired by the latters' failure to perfect their liens.
Although Bank contends otherwise, the record clearly discloses that Shelton was unable to pay the claims of the subcontractors and Shelton was in default at the time Surety paid the claims of the subcontractors.
15 O.S. 1971 § 382, provides that a surety, upon satisfying the obligations of a principal is entitled to enforce every remedy which the creditor then has against the principal, to the extent of reimbursing what he has expended.
15 O.S. 1971 § 383, provides that surety is entitled to the benefit of every security for the performance of the principal obligation held by the creditor or by a co-surety, at the time of entering into the contract of suretyship, or acquired by him afterwards, whether the surety was aware of the security or not.
The cited statutes were not intended to and do not abrogate or limit the equitable doctrine of subrogation; and the right of subrogation is not founded upon contract, express or implied, but upon principles of equity and justice. Maryland Casualty Company v. King, Okl., 381 P.2d 153. However, where the rights of parties to an action are clearly defined and established by law, equity has no power to change or unsettle such rights. The maxims of equity may be invoked to protect an existing right, but are unavailable to create a right where none exists. Equity follows the law. York v. Trigg, 87 Okl. 214, 209 P. 417.
Paraphrasing the language in 4 Corbin on Contracts [Legal Effects of Assignment, sec. 901, at page 609], Tipton, in the case at bar, is both an obligor and obligee. His duty to pay is accompanied by a right to the performance of the contract in exchange for his money, and his duty to pay does not in fact arise until performance of the contract. Bank's rights under its assignment from Shelton are also conditioned upon performance of the contract. However, if Surety does stand subrogated to the right of Tipton in relation to the funds withheld by Tipton, it is clear that Surety, not Bank, is entitled to the funds. This is so because when Shelton had not performed his part of the bargain, Shelton had no right to payment by Tipton and Shelton's assignee (Bank) had none. Insofar as the bargain had been performed at Surety's expense, under compulsion of the obligation of its bond, it would seem fair and just to give Surety that part of the payment still in the hands of the owner that stands dedicated to the fulfillment of the bargain; and it would seem patently unjust to let either Shelton or its assignee (Bank) profit by the performance rendered *1376 by Surety under compulsion of its obligation. This is the essence of the doctrine by which a performing surety may claim subrogation to the creditor's rights. The doctrine rests on the premise that although the owner (Tipton) is a debtor (obligor) as to the promised payments, he is also a creditor (obligee) as to full performance by the contractor (Shelton), and hence deferred contract payments still in the hands of the owner stand impressed by operation of the subrogation doctrine with a superior equity in favor of the surety's discharging the contractor's duty of performance under compulsion.
In the case of National Shawmut Bank of Boston, supra, (involving a public works contract) the court said that a performing surety, under compulsion, is entitled to step in three shoes. When, on default of the contractor, it pays all the bills of the job to date and completes the job, it stands in the shoes of the (1) contractor insofar as there are receivables due it; (2) in the shoes of laborers and materialmen who have been paid by the Surety; and, (3) not least, in the shoes of the government for whom the job was completed.
Framingham Trust Company v. Gould-National Batteries Inc., and American Casualty Company v. Framingham Trust Company, 427 F.2d 856 (1970), involved a private contract as in the case at bar. In Framingham, the Court of Appeals, First Circuit, determined that as against a secured creditor, a surety which completed a contract after contractor's default in the performance of a non-government construction contract was subrogated to owner's right to have laborers and materialmen paid out of the unpaid balance. The laborers and materialmen had failed to perfect their liens. The court reversed an adjudication by the trial court that the financing bank, which had obtained an assignment from the contractor and perfected its security interest under the Code, had priority over the subrogation rights of the performing surety. There the Court held:
"* * * We see no reason why that same equitable obligation to the laborers and materialmen should not exist on the part of the non-government owner, who receives the same benefit from those suppliers  construction work and materials  as did the government in the aforementioned cases. Moreover, the non-government owner, like the government, has an interest in seeing its suppliers paid so that the work necessary for completion of the contract can be done with minimum disruption and expense. See also National Surety Corp. v. United States, supra, 133 F. Supp. at 383.
"Therefore, since both the government and the non-government owner have the right to pay their suppliers out of the unpaid balance, the performing surety, through subrogation, is entitled to assert that right, and prevail over the secured creditor. National Shawmut Bank, supra, 411 F.2d at 848. The district court suggested, however, that according such right to the surety would circumvent the Massachusetts lien statutes, the materialmen and suppliers having failed to perfect a lien under Massachusetts General Laws, chapter 254, section 4, at the time of default. However, those lien statutes are circumvented just as much  or as little  by according the surety the right to be reimbursed for labor and material costs incurred subsequent to default, which right the district court readily recognized. We fail to see why it should preclude reimbursement to the surety for labor and material costs incurred prior to default when it clearly does not have that effect on reimbursement for such costs incurred after default.
"In sum, we cannot escape the conclusion that in both a practical and a legal sense, the payment of previously unpaid laborers and materialmen is a cost of completing the contract."
The general rule with respect to the right of the surety of a building contractor who completes the contract upon default by the contractor, to moneys in the hands of the contractee, earned by the contractor before default, is that upon completion of the contract the surety is entitled to be *1377 subrogated to the rights which the obligee had to, or could assert against, such funds upon the principal contractor's default to the extent necessary to reimburse itself for the outlay made to complete the contract. See 45 A.L.R. 380.
In the case at bar, the Shelton-Tipton contract was not completed in contemplation of law until the subcontractors' claims were paid. Tipton was entitled to withhold the retainage funds until the contract stood completed. Tipton had an interest in seeing that all the subcontractors' claims were paid whether or not they properly perfected their liens. Surety's bond to Tipton was made for their use and benefit and they were not required to perfect their liens in order to proceed against Surety on its bond.
We can see no basis for holding Surety's subrogated rights inferior to the assignment rights of Bank under the facts herein presented. At the time Bank made its loan to Shelton and obtained its assignment of a part of the Shelton-Tipton contract proceeds, Bank was not only charged with notice of the terms of the Shelton-Tipton contract, which provided that Tipton could require performance and payment bonds but it had actual notice that the contract was in fact bonded. The funds withheld by Tipton were not due and payable to either Shelton or Bank at the time Shelton was in default. Payment of the withheld funds become due and payable by Tipton only upon the performance of Surety.
We hold that Surety was subrogated to the rights of Tipton and the trial court correctly determined that the subrogated rights of Surety were superior to the assignment rights of Bank.
Judgment affirmed.
WILLIAMS, C.J., HODGES, V.C.J., and BERRY, SIMMS and DOOLIN, JJ., concur.
DAVISON and BARNES, JJ., concur.
LAVENDER, J., not participating.
