
741 P.2d 1370 (1987)
106 N.M. 249
SUNDANCE MECHANICAL & UTILITY CORPORATION, a New Mexico Corporation, Plaintiff-Appellee,
v.
Victor Lee ARMIJO and Dora Lee Armijo, his wife, Defendants-Appellants,
v.
Arthur S. PADILLA d/b/a Padilla & Sons Plastering, et al., Defendants-Appellees.
No. 16600.
Supreme Court of New Mexico.
September 1, 1987.
Tito D. Chavez, Albuquerque, for defendants-appellants.
James A. Artley, J. Kerwin Hollowwa, Albuquerque, for plaintiff-appellee Sundance.
Stuart Hines, Albuquerque, for defendant-appellee FED.
Sutin, Thayer & Browne, Jay D. Hertz, Sasha Siemel, Albuquerque, for defendant-appellee Whirlpool.
Bradford H. Zeikus, Albuquerque, for defendant-appellee McCullough.
*1371 Peter Everett, IV, Albuquerque, for defendant-appellee Hector Gonzales.
Toulouse, Toulouse & Garcia, Narciso Garcia, Jr., Albuquerque, for defendants-appellees Gentry and Valdez.

OPINION
STOWERS, Justice.
This appeal presents a single question: In a case where the original contractor gives no notice to the owner of a residence (containing not more than four dwelling units) regarding the right of subcontractors to file mechanics' and materialmen's liens, does NMSA 1978, Section 48-2-10.1 (Repl.Pamp. 1987) operate to discharge the owner from such liens filed less than ninety days after completion of construction but filed after the owner has made payment in full to the original contractor? The district court in this case held that NMSA 1978, Subsection 48-2-10.1(A) (Repl.Pamp. 1987) does not operate to discharge mechanics' and materialmen's liens filed against residential real property after the owners have paid in full the original contractor where, as here, the original contractor failed to notify the owners in accordance with the requirements of NMSA 1978, Subsection 48-2-10.1(B) (Repl.Pamp. 1987). The district court found the general lien statute, NMSA 1978, Section 48-2-6 (Repl.Pamp. 1987), controlling in the absence of statutory notice and ruled that the subcontractor's claim of lien was valid under that statute.
After examining the language of Section 48-2-10.1, and in view of our interpretation of that statute in Aztec Wood Interiors, Inc. v. Andrade Homes, Inc., 104 N.M. 45, 716 P.2d 236 (1986), and also the Legislature's intention in enacting it, we conclude that the district court incorrectly interpreted Section 48-2-10.1. We hold that the statute discharges mechanics' and materialmen's liens recorded after the owner has made full payment for construction work performed when the owner has not been given the written notice of potential lien claims prescribed by Subsection 48-2-10.1(B). We therefore reverse and remand this case to the district court for further proceedings.
In February 1984, Sundance Mechanical & Utility Corporation (plaintiff) contracted with Pacheco Construction Company (Pacheco) and provided labor, supplies, and services in connection with the construction of two four-unit residential buildings. Pacheco, the general contractor on the project and at that time the owner of the real property, completed construction about March 6, 1984, and on March 9, transferred title to Victor Lee Armijo and Dora Lee Armijo (defendants). Upon closing on March 23, 1984, defendants paid Pacheco and mortgaged the property. Subsequently, a number of mechanics' and materialmen's liens were filed against the property. Plaintiff filed its claim of lien on May 8, 1984, within ninety days after completion of the construction but more than twenty days after Pacheco had presented its contract of sale for payment by defendants.
On May 3, 1985, still unpaid by Pacheco for its work on the project, plaintiff brought this suit against defendants for debt and money due and to foreclose its claim of lien. Defendants' answer alleged, as an affirmative defense, that plaintiff's claim was barred under Section 48-2-10.1. Rejecting that argument, the district court granted summary judgment in favor of plaintiff and later denied defendants' motion for reconsideration. After a trial on the merits to evaluate the other lien claims made against the real property, the court entered a judgment and decree ordering foreclosure. Questioning the district court's interpretation of Section 48-2-10.1, defendants appeal.
In interpreting a statute, the court must ascertain and give effect to the intention of the legislature, which is to be determined primarily from the language used in the statute as a whole. Arnold v. State, 94 N.M. 381, 383, 610 P.2d 1210, 1212 (1980). In enacting Section 48-2-10.1, plaintiff contends, *1372 the Legislature intended not to extend protection from liens automatically to all owners of residential real property, but to offer the protection of Subsection 48-2-10.1(A) conditioned upon compliance with the notice procedures delineated in Subsection 48-2-10.1(B). To evaluate this argument, we must construe each part of the act in connection with every other part so as to produce a harmonious whole. Westgate Families v. County Clerk, 100 N.M. 146, 148, 667 P.2d 453, 455 (1983).
Subsection 48-2-10.1(A) in pertinent part states:
Payment by the owner to * * * any person entitled to such payment of all amounts due and owing for any construction * * * the performance of which could give rise to a lien pursuant to Section 48-2-2 NMSA 1978 to be performed upon a residence containing not more than four dwelling units shall discharge all such liens unless prior to such payment any person who is entitled to such a lien has filed for record his lien pursuant to Section 48-2-6 NMSA 1978.
Subsection 48-2-10.1(B) in pertinent part provides:
When an original contractor entitled to payment presents his bill for final payment, or an agreement for the sale of the premises, he shall notify the owner * * * in writing that liens may be filed within the next twenty working days. On the same day, he shall notify in writing [all unpaid subcontractors that the twenty-day period has commenced]. He shall furnish to the owner * * * an affidavit of mailing or delivery of such notification to [such subcontractors] * * *. If notice has been given to the owner * * * pursuant to this subsection, payment in full prior to the expiration of the twenty-day period shall not avail the owner * * * of the benefits of Subsection A of this section.
From the language used by the Legislature, it is clear to this Court that Subsection 48-2-10.1(A) generally discharges all liens for work done on residential buildings of four or fewer units recorded after the owner has made payment in full for the construction work. It is equally clear, from its final sentence, that Subsection 48-2-10.1(B) carves an exceptional twenty-day period for filing liens if proper notice has been given to the owner. We believe that the owner is entitled to the discharge of liens provided by Subsection 48-2-10.1(A) unless, and only unless, the owner has been given notice in compliance with Subsection 48-2-10.1(B).
We so stated in Aztec Wood Interiors, Inc. v. Andrade Homes, Inc., holding that where the owners were given an affidavit stating that there were no outstanding liens and made final payment in reliance thereon, mechanics' and materialmen's liens filed after that final payment were discharged under Subsection 48-2-10.1(A). Id. 104 N.M. at 46, 47, 716 P.2d at 237, 238. In that case, the subcontractor contended that it was entitled to ninety days in which to file its lien under Section 48-2-6 (the general lien statute) unless the owner succeeded in reducing the period to twenty days by complying with the notice procedures of Subsection 48-2-10.1(B). Id. at 46, 716 P.2d at 237. This Court rejected that argument and affirmed the district court's ruling that the lien was discharged under Subsection 48-2-10.1(A). Id. at 47, 716 P.2d at 238. Although the present case differs from Aztec Wood Interiors, Inc. v. Andrade Homes, Inc. in that the owners here were given no notice upon which they could rely, the plain language of the statute once again leads us to the conclusion that the Legislature granted Subsection 48-2-10.1(A) protection from liens to all owners of residential real property, and limited that protection, by establishing a twenty-day period for filing liens under Subsection 48-2-10.1(B), only in cases where the original contractor gives the owner proper notice of potential unpaid subcontractors.
This construction of Section 48-2-10.1 effectuates the intention of the Legislature which, we observed in Aztec Wood Interiors, *1373 Inc. v. Andrade Homes, Inc., was to protect an innocent purchaser from materialmen's liens once final payment was made to the contractor and to place upon the subcontractor a duty to file its lien prior to final payment. Id. at 47, 716 P.2d at 238. We properly may look to the history and the background of the statute in order to confirm this legislative intent. See First Nat'l Bank v. Southwest Yacht & Marine Supply Corp., 101 N.M. 431, 435, 684 P.2d 517, 521 (1984).
Our general lien statute, Section 48-2-6, has been in effect for more than one hundred years. See 1880 N.M. Laws, ch. 16, § 6. In 1979, the Legislature defeated a bill that would have reduced the ninety-day period for filing liens to fifteen days and would have discharged any liens filed after the owner made full payment unless the contractor or subcontractor notified the owner in writing of his potential lien claim before such payment. See H.R. 131, 34th Leg., 1st Sess., §§ 1 to 3 (1979). Retaining the ninety-day filing period, the Legislature enacted a law providing only for the discharge of liens filed by original contractors who failed to give the owners of residential property of no more than four units a prescribed written notice of the possibility of lien claims by subcontractors; the statute did not provide for the discharge of subcontractors' liens. See 1979 N.M. Laws, ch. 168, §§ 1 to 5.
Two years later, the Legislature repealed this rather insubstantial protective statute and enacted present Section 48-2-10.1, discharging liens filed by original contractors or subcontractors after full payment is made by the owner of a residential property of no more than four units unless proper notice under Subsection 48-2-10.1(B) is given to the owner by the original contractor and a reduced, twenty-day filing period is activated. See 1981 N.M. Laws, ch. 352, §§ 1, 2 (codified at § 48-2-10.1). In the same session, however, the Legislature defeated a bill that would have validated claims of liens filed after a deed to residential property was executed unless the owner had notified the original contractor of the date of the execution of deed and unless the contractor had in turn notified subcontractors of that date. See H.R. 645, 35th Leg., 1st Sess., § 1 (1981). The disposition of these 1981 bills indicates that the Legislature wished to extend protection from lien claims to owners of certain residential buildings without imposing upon them any duty to notify their original contractors and subcontractors, but that it was unwilling to extend to subcontractors a correlative protection of their lien claims.
In light of the history of this legislation, and the language used by the Legislature, and also our interpretation of that language here and in Aztec Wood Interiors, Inc. v. Andrade Homes, Inc., we conclude that Section 48-2-10.1 imposes no duty upon the owner of a residential building containing four or fewer units to obtain from the original contractor notice or an affidavit as described in Subsection 48-2-10.1(B) in order to enjoy the protection from liens provided by Subsection 48-2-10.1(A). We hold that where the original contractor gives no notice to the owner of such residential real property regarding the right of subcontractors to file mechanics' and materialmen's liens, Section 48-2-10.1 operates to discharge any such liens filed after the owner has made payment in full.
For the foregoing reasons, we hold that the district court erred in granting summary judgment in favor of plaintiff. Accordingly, we reverse the judgment and decree of the district court and remand this case for further proceedings consistent with this opinion.
IT IS SO ORDERED.
SCARBOROUGH, C.J., and RANSOM, J., concur.
