
463 N.W.2d 522 (1990)
George & Dorothy CHERGOSKY, Appellants
v.
CROSSTOWN BELL, INC., Robert T. Griffith & Alfred M. Teien, Respondents.
No. C0-89-2181.
Supreme Court of Minnesota.
November 30, 1990.
*523 Thomas E. Johnson, St. Paul, for appellants.
Phillip R. Krass, Shakopee, for respondents.
Heard, considered and decided by the court en banc.
KEITH, Justice.
This case raises the question whether a person who assumed the obligations of an unrecorded contract for deed at the time he acquired an interest in a piece of real property in Richfield, Minnesota, may assert priority over the unrecorded contract for deed after purchasing a mortgage on the property from a bona fide purchaser who recorded the mortgage before the contract for deed was recorded.
George and Dorothy Chergosky, appellants, brought this suit against Crosstown Bell, Inc. (Crosstown), and Alfred Teien for breach of a contract for deed agreement on the Richfield property. The Chergoskys also named Griffith and the law firm of Katz, Davis & Manka as parties to determine the priority of their interests in the property.[1] On cross motions for summary judgment, the district court held that Crosstown breached the contract for deed. The district court found damages against Crosstown in the amount of $97,850.65 plus prejudgment interest and costs and disbursements, and pierced the corporate veil to hold Teien also personally liable. The district court further held that the Chergoskys' claim was superior to those of both Griffith and Katz, Davis & Manka.
Crosstown, Teien, and Griffith appealed from the summary judgment entered in favor of the Chergoskys. The court of appeals upheld the trial court's award of damages to the Chergoskys and the imposition of personal liability on Teien but reversed the trial court's ruling on the priority issue and held that Griffith's mortgage was superior to the Chergoskys' contract for deed because Griffith acquired the mortgage through a bona fide purchaser. Chergosky v. Crosstown Bell, Inc., 454 N.W.2d 654, 656-57 (Minn.App.1990). We accepted the Chergoskys' petition for further review.

I
On November 4, 1971, Alfred and Donna Teien, the record owners of the property at 6244 Cedar Avenue in Richfield, leased the property as well as a building and garage to be constructed thereon to Northwestern Bell Telephone Company (Northwestern Bell) for a term of 20 years. The lease gave Northwestern Bell the option to purchase the property for $650,000 at the end of ten years. Alfred Teien later formed Crosstown Bell, Inc., a Minnesota corporation, of which Teien was the sole shareholder and officer. The Teiens transferred title to the Richfield property to Crosstown on April 27, 1972, and assigned the Northwestern Bell lease to Crosstown as well. Crosstown acquired permanent financing from Union Central Life Insurance Company, which took a first mortgage on the property that it recorded on September 12, 1972.
In 1977, in need of money, Alfred Teien contacted a friend, George Chergosky. Crosstown entered into a contract for deed conveying the vendee's interest in the Richfield property to George Chergosky and his wife Dorothy, made effective January 1, 1977. The purchase price of $550,000 included $50,000 up front and monthly payments of $5,504.89. The contract for deed gave Crosstown the option to repurchase the property from the Chergoskys, which would be required if Northwestern Bell *524 exercised its purchase option. The Chergoskys did not record the contract for deed until August 19, 1985.
On December 7, 1978, Alfred and Donna Teien borrowed $120,000 from Summit State Bank of Bloomington (Summit), and as security Crosstown gave a mortgage on the Richfield property that Summit recorded on December 18, 1978. Summit did not have notice of the Chergoskys' contract for deed at the time it took the mortgage.
In June 1982, Northwestern Bell notified Crosstown of its intention to exercise its lease purchase option. Crosstown disputed the timeliness of the notice, and in January 1983, brought a declaratory judgment action alleging that Northwestern Bell had not exercised its purchase option in a timely manner.
While this litigation was pending, on March 31, 1983, Robert Griffith, a long-time friend of Teien, acquired a 70% undivided interest in the Richfield property in exchange for past and present loans he made to Teien personally and to Crosstown. At the time Griffith, Teien, and Crosstown entered into this contract Griffith clearly had notice of the Chergoskys' contract for deed.
On August 22, 1985, while the litigation with Northwestern Bell still was pending, Griffith purchased the $120,000 note as well as other notes with a face value of $370,000 for $350,000 from Metropolitan Bank, Summit's assignee. As part of this transaction, Griffith received an assignment of the $120,000 second mortgage on the Richfield property, which Griffith recorded in November 1985.
On October 18, 1985, the trial court ordered Crosstown to convey marketable title to the Richfield property to Northwestern Bell, and ordered Northwestern Bell to pay the option purchase price into the court. See Crosstown Bell, Inc. v. Northwestern Bell Tel. Co., 381 N.W.2d 911 (Minn.App. 1986) (affirming the trial court's order). The subject matter of this dispute is the funds which remain on deposit with the court after satisfaction of the first mortgage pursuant to court order.

II
As the holder of the second mortgage, Griffith claims priority over the Chergoskys to the remaining proceeds from the sale of the Richfield property because he acquired the mortgage through a bona fide purchaser who recorded its mortgage before the Chergoskys recorded their contract for deed.
The Minnesota Recording Act provides in relevant part:
Every conveyance of real estate shall be recorded * * *; and every such conveyance not so recorded shall be void as against any subsequent purchaser in good faith and for a valuable consideration of the same real estate, or any part thereof, whose conveyance is first duly recorded * * *.
Minn.Stat. § 507.34 (1990).
Under the Minnesota Recording Act, a bona fide purchaser who records first obtains rights to the property which are superior to a prior purchaser who failed to record. Miller v. Hennen, 438 N.W.2d 366, 369 (Minn.1989). A bona fide purchaser is a subsequent purchaser in good faith, who paid value for the interest without actual, implied, or constructive notice of inconsistent outstanding rights of others. Id.
Generally, a bona fide purchaser of property which was subject to a prior outstanding unrecorded interest may pass title free of the unrecorded interest to a subsequent purchaser who otherwise would not qualify as a bona fide purchaser under the recording act. Henschke v. Christian, 228 Minn. 142, 147, 36 N.W.2d 547, 550 (1949). This bona fide purchaser filter rule protects the alienability of property. Without this rule the bona fide purchaser would be deprived of the full benefit of the purchase  the right to transfer good title to a subsequent purchaser. See, e.g., 8 G. Thompson, Commentaries on the Modern Law of Real Property § 4315, at 380 (1940 & photo. reprint 1963).
Summit paid valuable consideration for its mortgage, took the mortgage without notice of the Chergoskys' contract for *525 deed, and recorded the mortgage before the Chergoskys recorded their contract for deed. As between the Chergoskys' contract for deed and the second mortgage in the hands of Summit, Summit has priority. Generally, the filter principle then would operate to pass Summit's superior interest to Metropolitan and then to Griffith.

III
We first must examine the nature of the March 31, 1983, contract between Griffith, Teien, and Crosstown, to determine whether Griffith's rights and obligations under that contract affect his ability to claim the priority of a bona fide purchaser even though he had actual knowledge of the contract for deed when he acquired the mortgage.
The contract between Griffith, Teien, and Crosstown contained the following provisions relating to the contract for deed:
[I]n consideration of the mutual promises herein * * *, the parties hereto agree as follows:
I.
TRANSFERS TO GRIFFITH
Crosstown and Teien agree to transfer to Griffith the following:
A. A seventy percent (70%) undivided interest in the Property [described as the Richfield property in an exhibit to the contract]. Crosstown shall execute a Quit Claim Deed in form and substance substantially in the form attached hereto. . . .
B. A seventy percent (70%) interest in the vendor's interest in the Contract for Deed. . . . It is agreed and understood that the seventy percent (70%) assignment referenced in this sub-paragraph I.B. shall include any and all rights and/or obligations of Crosstown under the Contract for Deed, including any rights and/or obligations set forth in any exhibits or addenda to the Contract for Deed. Crosstown shall execute an Assignment of Contract for Deed in form and substance substantially in the form attached hereto. . . .
Griffith claims that this section of the instrument merely represents an offer that Griffith rejected in ¶ III.E. of the agreement, which states that Griffith does not assume any mortgage obligation or encumbrance other than the first mortgage.[2] Griffith also relies on ¶ IV of the instrument, which states that Crosstown/Teien shall bear the costs for the repurchase of the property under the contract for deed and that Crosstown/Teien shall reimburse Griffith for any amounts he pays to repurchase the property under the contract for deed.[3]
When the intention of the parties to a contract is totally ascertainable from the writing, construction is for the court. Hunt v. IBM Mid Am. Employees Fed. Credit Union, 384 N.W.2d 853, 856 (Minn. 1986). We construe a contract as a whole and attempt to harmonize all clauses of the contract. Telex Corp. v. Data Prods. Corp., 271 Minn. 288, 293, 135 N.W.2d 681, *526 685 (1965). Because of the presumption that the parties intended the language used to have effect, we will attempt to avoid an interpretation of the contract that would render a provision meaningless. Independent School Dist. No. 877 v. Loberg Plumbing & Heating, 266 Minn. 426, 436, 123 N.W.2d 793, 799-800 (1963).
Griffith's claim that paragraph I.B. of the contract was merely an offer that Griffith subsequently rejected contradicts the intention clearly expressed by the language of the contract read as a whole. The introduction to section I of the contract  "Transfers to Griffith"  states that "in consideration of the mutual promises herein * * * the parties hereto agree as follows." The plain meaning of this phrase is that the writing that follows represents the agreement among all the parties: Teien, Crosstown, and Griffith.
Griffith's asserted construction of the contract would render meaningless the paragraph that expressly states that the assignment to Griffith "shall include any and all rights and/or obligations of Crosstown under the Contract for Deed." (emphasis added). Read as a whole to harmonize the different parts of the instrument, the contract provides that Griffith assumes 70% of the obligations of the contract for deed but that Crosstown and Teien will be liable to Griffith for any amounts that he pays under the contract for deed. We thus conclude as a matter of law that Griffith assumed 70% of Crosstown's obligations under the contract for deed in the March 31, 1983 contract with Crosstown and Teien.

IV
The issue then becomes whether Griffith, who has assumed obligations to the Chergoskys based on the contract for deed, can rely on the bona fide purchaser filter principle to assert priority to the Richfield property over the Chergoskys. The bona fide purchaser filter principle is subject to a well-recognized exception, which prevents the grantor or former owner of the property, who held the property subject to a prior equity, from acquiring the rights of a bona fide purchaser. Walker v. Wilson, 469 So.2d 580, 582 (Ala.1985); Clark v. McNeal, 114 N.Y. 287, 295, 21 N.E. 405, 407 (1889).[4] Professor Cribbet wrote that this exception "prevents a holder of the title from using the [bona fide purchaser] as a `filter' to cleanse his defective ownership." J. Cribbet, Principles of the Law of Property 287-88 (2d ed. 1975). Pomeroy expressed the rationale for the filter principle as follows:
Were this not the rule, nothing would be easier than for a trustee to take advantage of his own wrong. It would only be necessary for him to make or permit a wrongful sale, in his individual capacity buy from the innocent purchaser, and then rely on the conveyance back as a shield with which to protect himself when sued for the very property which in the first instance, through a breach of duty, he allowed to be sold.
3 J. Pomeroy, A Treatise on Equity Jurisprudence § 754b, at 62 (S. Symons 5th ed. 1941). By asserting priority to the Richfield property, Griffith, in effect, is attempting to build title on his own default or at least on the default of Crosstown/Teien, with whom Griffith is closely associated and who, along with Griffith, is the co-owner of the vendor's interest in the property. See Conner v. How, 35 Minn. 518, 29 N.W. 314 (1886). In How, Mayo, who had purchased property and assumed the two mortgages on the property, defaulted on the first mortgage and then bought the property from the purchaser at the foreclosure sale. We held that Mayo remained liable on the second mortgage because he *527 could not "build up a title upon his own default." Id. at 520, 29 N.W. at 316.
We agree with the trial court that the same principles apply in this case. Griffith was obligated to the Chergoskys under the contract for deed. Griffith, prior to his acquisition of the second mortgage, held his 70% interest in the Richfield property subject to the Chergoskys' contract for deed and with a personal obligation to the Chergoskys under the contract for deed. See Barry v. Jordan, 116 Minn. 34, 37, 133 N.W. 78, 79 (1911). Having assumed the obligations of the contract for deed, Griffith cannot rely on the bona fide purchaser filter rule to obtain an interest in the property which is superior to the Chergoskys.
The bona fide purchaser filter rule is essential to the sound functioning of the secondary mortgage market. We emphasize that it is the unique facts concerning the March 31, 1983 contract, in which Griffith assumed 70% of the vendor's obligations to the Chergoskys under the contract for deed, that place this case in the well-recognized but limited exception to the bona fide purchaser filter principle.
We reverse the court of appeals and reinstate the trial court's judgment in favor of the Chergoskys on the priority issue.
NOTES
[1]  The Chergoskys also originally named Northwestern Bell, which was later dismissed from the suit.
[2]  This paragraph provides:

E. Griffith specifically does not assume any mortgage obligation presently encumbering the Property save and except a seventy percent (70%) interest in and to the First Mortgage * * * * Any other mortgage and/or encumbrance against the Property shall be the responsibility of Crosstown and/or Teien, and shall be payable out of the thirty percent (30%) interest retained in the Property by Crosstown and/or Teien.
In the event that * * * an event of default occurs in any mortgage or obligation encumbering the Property not assumed by Griffith, then, Griffith may, but is under no obligation to, expend a sum sufficient to cure any such default. For any such default cured by Griffith, he will have a specific lien in his favor against Crosstown/Teien's share in the bank account [to be created pursuant to the contract].
[3]  Paragraph IV provides:

It is contemplated that the parties will exercise their rights under the Contract for Deed to repurchase the subject Property. All cost including all payments associated with said repurchase shall be borne by Crosstown or Teien. Any amounts paid by Griffith shall be charged against Crosstown/Teien's share as provided in III.E or Paragraph III.F. At Griffith's direction, Crosstown shall immediately take all necessary actions to exercise its option under the Contract.
[4]  The Rhode Island Supreme Court applied this exception to the brother and wife of the original mortgagors who acquired a mortgage through a bona fide purchaser. Rogis v. Barnatowich, 36 R.I. 227, 89 A. 838 (1914). In Rogis, a church gave a first mortgage which was not recorded until after a second mortgage, given by the church and two of its members, was recorded. The court held that the brother and wife of these two members, who acquired the second mortgage from a bona fide purchaser, were not entitled to succeed to the rights of the bona fide purchaser. Id. at 231, 89 A. at 840.
