
758 P.2d 679 (1987)
Junior A. COLE and Ruby F. Cole, Plaintiffs-Appellees,
v.
Michael V. HOTZ, Defendant-Appellant.
No. 85CA1112.
Colorado Court of Appeals, Div. II.
August 27, 1987.
Rehearing Denied September 24, 1987.
Certiorari Petition Closed December 10, 1987.
*680 Coleman, Brown & Jouflas, Joseph Coleman, Grand Junction, for plaintiffs-appellees.
Frascona, McClow and Joiner, Lee D. Weinstein, Boulder, for defendant-appellant.
Certiorari Petition Closed, Cause Remanded to Court of Appeals December 10, 1987.
TURSI, Judge.
This appeal arises out of two cases which were consolidated in the trial court. In the *681 initial action, Junior A. Cole and Ruby F. Cole were plaintiffs, and Michael V. Hotz was defendant. In the second case, the Coles, among others, were named defendants, and Hotz was plaintiff. The Coles and Hotz filed cross-motions for partial summary judgments. The trial court granted the Coles' motion, entered judgment thereon, and denied Hotz' motion. The trial court then amended its order, and, properly under the facts of this case, entered a C.R.C.P. 54(b) order. We affirm.
These claims result from a complicated three-party land transaction. In 1981, Hotz and Junior A. Cole entered into negotiations aimed at effecting a tax-free exchange of certain properties. The Hotz property was located in Gunnison County and the Cole property was located in Mesa County. James Guthrie, Richard O'Connor, and Edward Slater (Guthrie Group) were involved as real estate brokers.
The accountants for the Coles and Hotz advised that in order to achieve the tax-free exchange desired, a third party to the transaction was necessary. In order to protect their commissions, the Guthrie Group became the third party.
Hotz conveyed the Gunnison property to the Guthrie Group, and received in exchange a note and a "wrap-around" deed of trust captioned: "All Encompassing Deed of Trust" (the Trust Deed) and an "All Encompassing Note" (the Note). This conveyance to the Guthrie Group was made subject to the existing encumbrances upon the Gunnison property (Gunnison Encumbrances).
The Guthrie Group conveyed the Gunnison property to the Coles, and received in exchange two parcels of property (Parcels I and II) in Mesa County. The Guthrie Group then conveyed Parcel II of the Mesa property to Hotz and kept Parcel I. Hotz also received a second note to secure payment of an interest differential that he had bargained for from the Guthrie Group secured by a subordinated mortgage on the parcel of land retained by the Guthrie Group in their land exchange with the Coles.
At the time the Gunnison property was conveyed to the Guthrie Group, it was encumbered by six debts totalling $978,059.09 (Gunnison Encumbrances). Hotz admits he remains personally liable on these debts and that the Coles are not personally liable for them. The Coles admit that they took the Gunnison property subject to these encumbrances.
To complete the transaction, Hotz, the Coles, and the Guthrie Group executed an escrow agreement which tied together the various exchanges. The escrow agreement also required that the Guthrie Group's payments on the promissory notes held by Hotz be paid on the Gunnison Encumbrances.
The Guthrie Group subsequently defaulted on the Note and neither the Guthrie Group nor Hotz made payment on the Gunnison Encumbrances. The Coles have paid one of the Gunnison Encumbrances (Farner Note) to cure default.
The Coles filed two actions. The first was filed in Mesa County. This action resulted in the Coles' foreclosure on the Guthrie Group's Mesa County Property, Parcel I, pursuant to the Guaranty Agreement and netted them $299,849.50. The second action was filed in Gunnison County against Hotz. The Coles sought, inter alia, a declaratory judgment, a money judgment to pay the Gunnison Encumbrances, and an order enjoining Hotz from foreclosing on their property under the Trust Deed.
In Hotz' action, he sought a money judgment from the Guthrie Group and foreclosure on the Gunnison property under the Trust Deed. The Guthrie Group filed for protection under the bankruptcy code.
The trial court ruled the land exchange documents were clear and unambiguous and concluded that the Coles were entitled to enforce Hotz's promise to pay the Gunnison Encumbrances as third-party beneficiaries since his promise inured to their direct benefit. It awarded the Coles judgment in the amount due on the Gunnison Encumbrances ($976,278.01), plus interest, attorney fees, and costs. However, it limited *682 their right to execute judgment by the following provisos:
"No execution on the judgment may occur until the Coles prove payment of all or part of the Gunnison Encumbrances, and affirmative steps to execute on the above judgment in favor of Coles shall be stayed
. . . .
To the extent the Coles receive the benefit of any funds as the result of their suit against the Guthrie Group and their foreclosure on Parcel [I] of the Mesa County Property now pending in the Mesa County District Court, Hotz shall receive full credit against the foregoing judgment for all funds and benefits so received by the Coles."
The trial court also denied the partial summary judgment requested by Hotz, and enjoined him from foreclosing against the Coles. It concluded it would be inequitable to permit Hotz to foreclose on the Trust Deed against the Coles because his failure to pay the obligations upon which he was primarily liable had exposed the Coles to foreclosure by the Gunnison Encumbrances lienholders.
Subsequently, the trial court entered another order clarifying its judgment. It reduced the Coles' judgment against Hotz by the amount bid at the foreclosure sale on the Guthrie Group's Mesa County property ($299,849.50). It also found the Coles had paid the Farner Note ($48,092.62) and granted the Coles immediate right to execute on their judgment for that amount.

I
Hotz first argues that the trial court erred in granting the Coles' motion for summary judgment as there existed genuine issues of material fact. We disagree.
Neither party argued that the pertinent documents were ambiguous. Extraneous evidence is only admissible to prove intent where there is an ambiguity in the terms of the contract. Radiology Professional Corp. v. Trinidad Area Health Ass'n, 195 Colo. 253, 577 P.2d 748 (1978). Therefore, determination of the cross-motions for summary judgment may be made by interpreting the written documents effecting the land exchange.
Hotz argues that the trial court erred in finding that the Coles were third-party beneficiaries of Hotz' promise to the Guthrie Group. Alternatively, he argues that, even if the court was correct in that finding, the Guthrie Group's failure to perform the contract by failing to pay him is a defense against the Coles' claim to enforce the contract as third-party beneficiaries. He cites Restatement (Second) of Contracts § 309(2) comment b (1981) and argues the contract ceases to be binding for present failure to perform.
However, we agree with the Coles' contention that the Hotz obligation to pay the Gunnison Encumbrances was a direct contractual liability owed to the Coles as parties to the total contract and not as third-party beneficiaries. A correct judgment will not be disturbed on review even though the reason for the decision may be wrong. Miller v. Mountain Valley Ambulance Service, Inc., 694 P.2d 362 (Colo.App. 1984). Therefore, we do not address the third-party beneficiary issue.
Since the agreement between the parties was contained in several documents, we must construe those documents together as though they comprise a single document. Gibbs v. Wallace, 58 Colo. 364, 147 P. 686 (1915); Chambliss/Jenkins Associates v. Forster, 650 P.2d 1315 (Colo. App.1982). Paragraph two of the escrow agreement reads: "The Coles have no obligation to pay said promissory note which remains the sole obligation of Hotz." Unambiguous terms are not to be varied by extrinsic evidence and should be given effect, as a matter of law, by the court. Pepcol Manufacturing Co. v. Denver Union Corp., 687 P.2d 1310 (Colo.1984). We conclude, pursuant to the documents and undisputed fact, that Hotz remained the primary obligor of all the indebtedness, and therefore, equity demanded that he not be allowed to profit by failure to pay his primary obligation. See Sanders v. Black, 136 Colo. 417, 318 P.2d 1100 (1957).
*683 The trial court's ruling is in essence a declaratory judgment that the Coles have the right of subrogation for all payments they are compelled to make on the Gunnison Encumbrances to protect their property from foreclosure. Subrogation is the substitution of another in the place of a creditor. It is an equitable remedy invoked to prevent injustice and compels the ultimate payment of a debt by the one who in justice, equity, and good conscience ought to pay it. Behlen Manufacturing Co. v. First National Bank, 28 Colo.App. 300, 472 P.2d 703 (1970).
Here, Hotz has repeatedly admitted his personal obligation to pay the Gunnison Encumbrances. When the Coles are compelled to pay these debts for Hotz in order to protect their property from foreclosure, they become entitled to the right of subrogation. Martynes & Associates v. Devonshire Square Apartments, 680 P.2d 246 (Colo.App.1984). Therefore, we conclude there is no genuine issue of material fact, and the Coles are entitled to the summary judgment as a matter of law. Bailey v. Clausen, 192 Colo. 297, 557 P.2d 1207 (1976).
Hotz also contends the Coles were not entitled to a money judgment against him since they had a remedy in their lien on Parcel I of the Mesa County property owned by the Guthrie Group. We disagree. While the Coles may obtain only one satisfaction to compensate them for the Gunnison Encumbrances they pay, they are free to obtain as many judgments against as many different parties on as many different theories as they can establish to obtain such satisfaction. Coons v. Peterson Realty, Inc., 695 P.2d 317 (Colo. App.1985).
Hotz further asserts the Coles' money judgment is in addition to his liability on the underlying debts thus dictating that he pay the same debt twice. However, Hotz misinterprets the effect of the trial court's judgment. Since the Coles may only execute on that part of the judgment for which they can prove payment of the underlying debt, Hotz is not subjected to double liability.

II
Finally, we reject Hotz' argument that the trial court erred by permanently enjoining him from foreclosing the interest of the Coles in the Gunnison property pursuant to the trust deed. Equity may fashion a remedy to effect justice suitable to the circumstances of the case. Rice v. Hilty, 38 Colo.App. 338, 559 P.2d 725 (1976); Handy v. Rogers, 143 Colo. 1, 351 P.2d 819 (1960). Here, Hotz admits he had contracted to remain personally liable for the Gunnison Encumbrances under the terms of the exchange and that it is the failure of these payments which subjected the property to foreclosure. Therefore, we agree with the trial court that it is inequitable to allow Hotz to foreclose the Trust Deed against the Coles.
Judgment affirmed.
SMITH and BABCOCK, JJ., concur.
