Exhibit 10.4 FIRST AMENDMENT TO PURCHASE AND SALE AGREEMENT THIS FIRST AMENDMENT TO PURCHASE AND SALE AGREEMENT, dated as of December 17, 2004 (this "Amendment"), is entered into among ATRIUM COMPANIES, INC. ("Atrium"), individually and as the Servicer, ATRIUM DOOR AND WINDOW COMPANY OF THE NORTHEAST ("Atrium Northeast"), ATRIUM DOOR AND WINDOW COMPANY - WEST COAST ("Atrium West Coast"), ATRIUM DOOR AND WINDOW COMPANY OF ARIZONA ("Atrium Arizona"), ATRIUM VINYL, INC. (f/k/a Heat, Inc.) ("Atrium Vinyl"), ATRIUM DOOR AND WINDOW COMPANY OF THE NORTHWEST (f/k/a Best Built, Inc.) ("Atrium Northwest"), ATRIUM DOOR AND WINDOW COMPANY OF THE ROCKIES (f/k/a Champagne Industries, Inc.) ("Atrium Rockies"), THERMAL INDUSTRIES, INC. ("Thermal"), ATRIUM EXTRUSION SYSTEMS, INC. (f/k/a VES, Inc.) ("Extrusion") (Atrium, Atrium Northeast, Atrium West Coast, Atrium Arizona, Atrium Vinyl, Atrium Northwest, Atrium Rockies, Thermal and Extrusion are herein collectively called the "Originators" and individually called an "Originator"), ALUMINUM SCREEN MANUFACTURERS, INC., a Delaware corporation ("Aluminum"), ATRIUM WINDOWS AND DOORS OF FLORIDA, LLC, a Delaware limited liability company ("Atrium Florida"), ATRIUM SHUTTERS, INC., a Texas corporation ("Shutters"), SUPERIOR ENGINEERED PRODUCTS CORPORATION, a California corporation ("Superior") (Aluminum, Atrium Florida, Shutters and Superior are herein collectively called the "New Originators" and individually called a "New Originator"), and ATRIUM FUNDING CORPORATION, a Delaware corporation ("AFC"). RECITALS: 1. The Originators and AFC are parties to the Purchase and Sale Agreement, dated as of July 30, 2001(the "Purchase and Sale Agreement"); 2. Each party hereto desires to amend the Purchase and Sale Agreement to add the New Originators as Originators party thereto; NOW THEREFORE, for good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties agree as follows: 1. Certain Defined Terms. Capitalized terms that are used but not defined herein have the meanings set forth in the Purchase and Sale Agreement. 2. Joinder. Each New Originator, severally and for itself alone, hereby agrees to be bound by the terms and conditions of the Purchase and Sale Agreement (as amended hereby) and shall have all the rights and obligations of an Originator thereunder (and under any other Transaction Document) to the same extent as if it were an original party thereto, effective upon the effectiveness of this Amendment. 3. Amendments to the Purchase and Sale Agreement. (a) Each New Originator is hereby added as an "Originator" under the Purchase and Sale Agreement and each New Originator shall for all purposes be an Originator party to the Purchase and Sale Agreement and shall have all the rights and obligations of an Originator thereunder (and under any other Transaction Document) to the same extent as if it were an original party thereto and all references to (i) each "Originator" and (ii) the "Originators" in the Purchase and Sale Agreement and the other Transactions Documents shall be deemed to include each New Originator. (b) With respect to each New Originator, any reference in the Purchase and Sale Agreement to the "Closing Date" or the "date hereof" shall be deemed to be a reference to "December 17, 2004". (c) With respect to each New Originator, any reference in the Purchase and Sale Agreement to the "Cut-off Date" shall be deemed to be a reference to "December 17, 2004". (d) With respect to Atrium, the reference in Section 5.9(a) of the Purchase and Sale Agreement to "December 31, 2000" shall be deemed to be a reference to "December 31, 2003". (e) Section 7.3(b) to the Purchase and Sale Agreement is hereby amended and restated in its entirety as follows: (b) on the Closing Date and from time to time, if requested thereafter, mark the master data processing records that evidence or list such Receivables and related Contracts with substantially the following legend: "THE RECEIVABLES DESCRIBED HEREIN HAVE BEEN SOLD PURSUANT TO A PURCHASE AND SALE AGREEMENT, DATED AS OF JULY 31, 2001, AS THE SAME MAY FROM TO TIME TO TIME BE AMENDED, SUPPLEMENTED OR OTHERWISE MODIFIED, BETWEEN CERTAIN ENTITIES LISTED ON SCHEDULE I THERETO, AS ORIGINATORS, AND ATRIUM FUNDING CORPORATION, AS PURCHASER, AND AN UNDIVIDED, FRACTIONAL OWNERSHIP INTEREST IN THE RECEIVABLES DESCRIBED HEREIN HAS BEEN SOLD TO FAIRWAY FINANCE COMPANY, LLC (F/K/A FAIRWAY FINANCE CORPORATION) PURSUANT TO A RECEIVABLES PURCHASE AGREEMENT, DATED AS OF JULY 31, 2001, AS THE SAME MAY FROM TO TIME TO TIME BE AMENDED, SUPPLEMENTED OR OTHERWISE MODIFIED, AMONG ATRIUM FUNDING 2 CORPORATION, AS SELLER, ATRIUM COMPANIES, INC., AS SERVICER, FAIRWAY FINANCE COMPANY, LLC (F/K/A FAIRWAY FINANCE CORPORATION) AND HARRIS NESBITT CORP. (F/K/A BMO NESBITT BURNS CORP.), AS AGENT." (f) Schedule I to the Purchase and Sale Agreement is hereby amended and restated in its entirety as attached hereto. (g) Schedule 5.6 to the Purchase and Sale Agreement is hereby amended and restated in its entirety as attached hereto. (h) Schedule 5.14A to the Purchase and Sale Agreement is hereby amended and restated in its entirety as attached hereto. (i) Schedule 5.14B to the Purchase and Sale Agreement is hereby amended and restated in its entirety as attached hereto. (j) Schedule 5.15 to the Purchase and Sale Agreement is hereby amended and restated in its entirety as attached hereto. 4. Representations and Warranties. Each New Originator hereby makes, as of the date hereof, all of the representations and warranties set forth in Article V of the Purchase and Sale Agreement (as amended hereby). Each Originator and New Originator hereby represents and warrants to the Purchaser and the Agent as follows: (a) Representations and Warranties. The representations and warranties made by it in the Transactions Documents are true and correct as of the date hereof. (b) Enforceability. The execution and delivery by it of this Amendment, and the performance of its obligations under this Amendment and the Purchase and Sale Agreement (as amended hereby) are within its corporate powers and have been duly authorized by all necessary corporate action on its part. Each of this Amendment and the Purchase and Sale Agreement (as amended hereby) is its valid and legally binding obligations, enforceable in accordance with its terms, except as enforceability may be limited by bankruptcy, insolvency, reorganization or other similar laws affecting the enforcement of creditors' rights generally and by general principles of equity, regardless of whether such enforceability is considered in a proceeding in equity or at law. (c) No Default. Both before and immediately after giving effect to this Amendment and the transactions contemplated hereby, no Purchase and Sale Termination Event or Unmatured Purchase and Sale Termination Event exists or shall exist. 5. Effect of Amendment. All provisions of the Purchase and Sale Agreement, as expressly amended and modified by this Amendment, shall remain in full force and effect. After this Amendment becomes effective, all references in the Purchase and Sale Agreement (or in any other Transaction Document) to "this Agreement," "hereof," "herein" or words of similar effect referring to the Purchase and Sale Agreement shall be deemed to be references to the Purchase 3 and Sale Agreement as amended by this Amendment. This Amendment shall not be deemed, either expressly or impliedly, to waive, amend or supplement any provision of the Purchase and Sale Agreement other than as set forth herein. 6. Effectiveness. This Amendment shall become effective as of the date hereof upon receipt by the Agent of the following, in form and substance satisfactory to the Agent: (a) an original of this Amendment duly executed and delivered by each of the parties hereto; (b) an Originator Assignment Certificate duly completed, executed and delivered by each New Originator; (c) a Company Note in favor of each New Originator, each duly executed by AFC; (d) with respect to each New Originator, a Joinder Agreement, duly executed by such New Originator, AFC and the Agent; (e) evidence in form and substance satisfactory to the Agent of financing statements (Form UCC-1), to be filed as of the date hereof, as may be necessary or desirable, in the opinion of the Agent, under the UCC of all appropriate jurisdictions to perfect AFC's ownership interest in all Receivables and such other rights, accounts, instruments and moneys (including, without limitation, Related Security) in which an ownership or security interest may be assigned to it hereunder; (f) a written search report from a Person satisfactory to the Servicer and the Agent listing all effective financing statements that name any New Originator as debtor or assignor and that are filed in the jurisdictions in which filings were made pursuant to the foregoing clause (e) and any additional jurisdictions as may be necessary or desirable, in the opinion of the Agent, together with copies of such financing statements (none of which, except for those described in the foregoing clause (e), shall cover any Receivable or any right related to any Receivable or Related Security) which is to be sold to AFC pursuant to the Purchase and Sale Agreement, and (ii) tax and judgment lien search reports from a Person satisfactory to the Servicer and the Agent showing no evidence of such liens filed against any New Originator; (g) a copy of the resolutions of the Board of Directors or members of each New Originator, in each case approving this Amendment, the Purchase and Sale Agreement (as amended hereby) and any other agreements or documents and transactions contemplated hereby or thereby, and in each case certified by the Secretary of an Assistant Secretary of such Person; (h) a good standing certificate for each New Originator issued as of a recent date acceptable to the Agent by the Secretary of State of the jurisdiction of such Person's incorporation; 4 (i) a certificate of the Secretary or an Assistant Secretary of each New Originator, in each case certifying the names and true signatures of the officers authorized on such Person's behalf to sign the Transaction Documents to be delivered by it (on which certificates the Agent, the Servicer and AFC may conclusively rely until such time as the Agent and the Servicer shall receive from any such Person a revised certificate meeting the requirements of this paragraph); (j) the certificate or articles of incorporation or other organizational document of each New Originator, duly certified by the Secretary of State (or analogous government authority) of the jurisdiction of its incorporation or organization as of a recent date acceptable to the Agent, together with a copy of the by-laws of each New Originator, each duly certified by the Secretary or an Assistant Secretary of such New Originator; (k) a certificate from an officer of each New Originator to the effect that the Servicer and such New Originator have placed on the most recent, and have taken all steps reasonably necessary to ensure that there shall be placed on each subsequent, data processing report that it generates which are of the type which any proposed purchaser or lender would use to evaluate the Receivables, substantially the following legend: "THE RECEIVABLES DESCRIBED HEREIN HAVE BEEN SOLD PURSUANT TO A PURCHASE AND SALE AGREEMENT, DATED AS OF JULY 31, 2001, AS THE SAME MAY FROM TO TIME TO TIME BE AMENDED, SUPPLEMENTED OR OTHERWISE MODIFIED, BETWEEN CERTAIN ENTITIES LISTED ON SCHEDULE I THERETO, AS ORIGINATORS, AND ATRIUM FUNDING CORPORATION, AS PURCHASER, AND AN UNDIVIDED, FRACTIONAL OWNERSHIP INTEREST IN THE RECEIVABLES DESCRIBED HEREIN HAS BEEN SOLD TO FAIRWAY FINANCE COMPANY, LLC (F/K/A FAIRWAY FINANCE CORPORATION) PURSUANT TO A RECEIVABLES PURCHASE AGREEMENT, DATED AS OF JULY 31, 2001 AS THE SAME MAY FROM TO TIME TO TIME BE AMENDED, SUPPLEMENTED OR OTHERWISE MODIFIED, AMONG ATRIUM FUNDING CORPORATION, AS SELLER, ATRIUM COMPANIES, INC., AS SERVICER, FAIRWAY FINANCE COMPANY, LLC AND HARRIS NESBITT CORP. (F/K/A BMO NESBITT BURNS CORP.), AS AGENT."; and (l) favorable opinions from Paul, Hastings, Janofsky & Walker LLP, special counsel to certain Originators, the New Originators, Atrium and AFC, each in form and substance satisfactory to the Agent regarding: (i) certain corporate and enforceability matters; (ii) certain bankruptcy matters; and (iii) certain UCC matters relating to Atrium Vinyl, Atrium Northwest, Extrusion, Atrium Rockies and each New Originator. 5 7. Covenants. Within 30 days after the date hereof, each New Originator shall deliver to the Servicer and the Agent (with a copy for the Purchaser) a certificate from an authorized officer to the effect that: (a) the name of the renter of all post office boxes into which Collections of the Receivables originated by each New Originator may from time to time be mailed have been changed to the name of AFC (unless such post office boxes are in the name of the relevant Lock-Box Banks) and (b) all relevant postmasters have been notified that each of the Servicer and the Agent are authorized to collect mail delivered to such post office boxes (unless such post office boxes are in the name of the relevant Lock-Box Banks). 8. Counterparts. This Amendment may be executed in any number of counterparts and by different parties on separate counterparts, each of which when so executed shall be deemed to be an original and all of which when taken together shall constitute but one and the same instrument. 9. Governing Law. This Amendment shall be governed by, and construed in accordance with, the laws of the State of New York (without giving effect to the conflict of laws principles thereof). 10. Section Headings. The various headings of this Amendment are included for convenience only and shall not affect the meaning or interpretation of this Amendment, the Purchase and Sale Agreement or any provision hereof or thereof. [SIGNATURE PAGES FOLLOW] 6 IN WITNESS WHEREOF, the parties have executed this Amendment as of the date first written above. ATRIUM FUNDING CORPORATION By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM COMPANIES, INC., individually and as Servicer By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM DOOR AND WINDOW COMPANY OF THE NORTHEAS By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM DOOR AND WINDOW COMPANY - WEST COAST By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer S-1 Purchase and Sale Agreement Amendment #1 (Atrium) ATRIUM DOOR AND WINDOW COMPANY OF ARIZONA By: ----------------------------------------- Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM VINYL, INC. By: ----------------------------------------- Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM DOOR AND WINDOW COMPANY OF THE NORTHWEST By: ----------------------------------------- Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM DOOR AND WINDOW COMPANY OF THE ROCKIES By: ----------------------------------------- Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer S-2 Purchase and Sale Agreement Amendment #1 (Atrium) THERMAL INDUSTRIES, INC. By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ATRIUM EXTRUSION SYSTEMS, Inc. By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer ALUMINUM SCREEN MANUFACTURERS, INC. By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer Address: 3890 West Northwest Highway Suite 500 Dallas, Texas 75220 Attention: Eric Long Facsimile: (214) 630-8931 ATRIUM WINDOWS AND DOORS OF FLORIDA, LLC By: ATRIUM SHUTTERS, INC., sole member and sole manager of Atrium Windows and Doors, LLC By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer Address: 3890 West Northwest Highway Suite 500 Dallas, Texas 75220 Attention: Eric Long Facsimile: (214) 630-8931 S-3 Purchase and Sale Agreement Amendment #1 (Atrium) ATRIUM SHUTTERS, INC. By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer Address: 3890 West Northwest Highway Suite 500 Dallas, Texas 75220 Attention: Eric Long Facsimile: (214) 630-8931 SUPERIOR ENGINEERED PRODUCTS CORPORATION By: ------------------------------------------ Name: Jeff L. Hull Title: Chairman, President and Chief Executive Officer Address: 3890 West Northwest Highway Suite 500 Dallas, Texas 75220 Attention: Eric Long Facsimile: (214) 630-8931 S-4 Purchase and Sale Agreement Amendment #1 (Atrium) ACKNOWLEDGED AND AGREED: FAIRWAY FINANCE COMPANY, LLC (f/k/a Fairway Finance Corporation), as Purchaser By: ------------------------------------------------- Name: -------------------------------------- Title: ------------------------------------- HARRIS NESBITT CORP. (f/k/a BMO Nesbitt Burns Corp.), as Agent By: ------------------------------------------------- Name: -------------------------------------- Title: ------------------------------------- S-5 Purchase and Sale Agreement Amendment #1 (Atrium)