Exhibit 10.4 SECOND AMENDMENT AND WAIVER TO LOAN DOCUMENTS THIS SECOND AMENDMENT AND WAIVER TO LOAN DOCUMENTS (this "Amendment and Waiver"), dated as of July 19, 1996, by and among GENESIS HEALTH VENTURES, INC., a Pennsylvania corporation (together with its successors, "Genesis"), the Subsidiaries of Genesis which are parties to the Revolving Credit Agreement (as defined below) or the Acquisition Credit Agreement (as defined below) (such Subsidiaries referred to collectively with Genesis as the "Borrowers"), MELLON BANK, N.A., a national banking association, as agent for the Lenders and the Issuer under and as defined in the Revolving Credit Agreement and under the other Loan Documents (as defined in the Revolving Credit Agreement) (in such capacity, together with its successors in such capacity, the "RCA Agent") and as Agent for the Lenders under and as defined in the Acquisition Credit Agreement and under the other Loan Documents (as defined in the Acquisition Credit Agreement) (in such capacity, together with its successors in such capacity, the "ACA Agent" and collectively with the RCA Agent, the "Agent") and MELLON BANK, N.A. a national banking association, as Collateral Agent for the Secured Parties (as defined in the Collateral Agency Agreement referred to in the Revolving Credit Agreement and the Acquisition Credit Agreement) (in such capacity, together with its successors in such capacity, the "Collateral Agent"); WITNESSETH THAT WHEREAS, certain of the Borrowers, the Lenders party thereto, the Issuer party thereto, the RCA Agent and the Co-Agent named therein executed and delivered that certain Amended and Restated Credit Agreement dated as of September 29, 1995, as previously amended as of April 12, 1996 (the "Existing Revolving Credit Agreement"); and WHEREAS, certain of the Borrowers, the Lenders party thereto, the ACA Agent and the Co-Agent named therein executed and delivered that certain Acquisition Credit Agreement dated as of September 29, 1995, as amended as of April 12, 1996 (the "Existing Acquisition Credit Agreement"); and WHEREAS, the Borrowers wish to enter into a certain Synthetic Lease, which Lease would replace the Acquisition Credit Agreement; and WHEREAS, the terms of the Existing Revolving Credit Agreement and the Existing Acquisition Credit Agreement would not permit the Borrowers to enter into such a Synthetic Lease; and WHEREAS, the Borrowers have requested that the Existing Revolving Credit Agreement, the Existing Acquisition Credit Agreement and -2- certain Loan Documents be amended and certain waivers thereto be granted to allow for the Synthetic Lease transaction; and WHEREAS, the Lenders are willing to amend the Existing Revolving Credit Agreement, the Existing Acquisition Credit Agreement and certain Loan Documents and enter into certain waivers in the manner set forth in this Amendment and Waiver. The Existing Revolving Credit Agreement as previously supplemented and as amended and modified by this Amendment and Waiver is herein referred to as the "Revolving Credit Agreement"; the Existing Acquisition Credit Agreement as previously supplemented and as amended and modified by this Amendment and Waiver is referred to herein as the "Acquisition Credit Agreement". Capitalized terms used but not defined in this Amendment and Waiver have the meanings assigned to them in, or by reference in, the Revolving Credit Agreement, or in the Acquisition Credit Agreement as the context requires. NOW, THEREFORE, in consideration of the foregoing premises and other valuable consideration and intending to be legally bound, the parties hereto agree as follows: -3- I. Amendments and Waivers to Existing Revolving Credit Agreement ------------------------------------------------------------- and Existing Acquisition Credit Agreement ----------------------------------------- 1.1 Definition of Indebtedness. The definition of "Indebtedness" in Section 1.1 of the Existing Revolving Credit Agreement and Section 1.1 of the Existing Acquisition Credit Agreement is amended in each of the following respects: 1.1.1 by deleting the word "and" at the end of clause (g) thereof; 1.1.2 by replacing the period at the end of clause (h) thereof with a semicolon and the word "and"; and 1.1.3 by adding the following new clause (i) at the end of said definition following clause (h): "(i) without duplication, all obligations of Genesis or any of its Subsidiaries under, or in respect of, the Synthetic Lease." 1.2 Definition of Synthetic Lease. The following new definition shall be added in its correct alphabetical location in Section 1.1 of the Existing Revolving Credit Agreement and the Existing Acquisition Credit Agreement: -4- "Synthetic Lease" shall mean a synthetic lease facility entered, or to be entered, into by Genesis and/or one or more of its Subsidiaries on substantially the terms set forth in the Outline of Terms of the Synthetic Lease (Summary of Principal Terms and Conditions) thereof dated 6/19/96 with such modifications thereto as the parties to such facility may determine so long as such modifications would not be reasonably likely to have a material adverse effect on the Lender Parties together with all agreements, instruments and documents delivered thereunder or in connection therewith, and any amendment, supplement, modification, refinancing, restatement thereto or thereof. 1.3 Permitted Liens. Section 7.02 of the Existing Revolving Credit Agreement and 6.02 of the Acquisition Credit Agreement are amended in each of the following respects: 1.3.1 by deleting the word "and" in clause (g) thereof; 1.3.2 by adding the word "and" after the semicolon in clause (h) thereof; and 1.3.3 by adding the following new clause (i) immediately following clause (h) thereof: "(i) the Synthetic Lease and the Liens substantially as described in the Outline of Terms of the Synthetic Lease (Summary of Principal Terms and Conditions) dated 6/19/96 which secure obligations in respect of the Synthetic Lease;" -5- 1.4 Indebtedness Covenant. Section 7.03 of the Existing Revolving Credit Agreement and Section 6.03 of the Existing Acquisition Credit Agreement are amended in each of the following respects: 1.4.1 by deleting the word "and" at the end of clause (h) thereof; 1.4.2 by replacing the period at the end of clause (i) thereof with a semicolon and the word "and"; and 1.4.3 by adding a new clause (j) immediately following clause (i) thereof as follows: " (j) Indebtedness in a principal amount not to exceed One Hundred Eleven Million Dollars ($111,000,000) pursuant to the Synthetic Lease." 1.5 Lease Covenant. Section 7.08 of the Existing Revolving Credit Agreement and Section 6.08 of the Existing Acquisition Credit Agreement are amended in each of the following respects: 1.5.1 by deleting the word "and" at the end of clause (c) thereof; 1.5.2 by adding a new clause (d) immediately following clause (c) thereof as follows: "(d) the Synthetic Lease (including, without limitation, any subleases and ground leases entered into in connection therewith); and"; and -6- 1.5.3 by redesignating the existing clause (d) as clause (e). 1.6 Assets of Lessee as Collateral. Section 10.16 of the Existing Revolving Credit Agreement and Section 9.16 of the Existing Acquisition Credit Agreement are amended by adding a new paragraph (i) immediately following paragraph (h) thereof as follows: (i) Lessee Assets. Notwithstanding anything to the contrary set forth herein, if a Subsidiary shall become a Joining Subsidiary hereunder in connection with the transactions described in the Outline of Terms of the Synthetic Lease (Summary of Principal Terms and Conditions) dated 6/19/96, then this Section shall not require the grant of a security interest in the assets of the Joining Subsidiary (other than stock of other Joining Subsidiaries) and any joinders or other documents required hereunder to be delivered by the Joining Subsidiary shall be modified accordingly. 1.7 Certain Waivers. In addition to the foregoing amendments, in order to facilitate the Synthetic Lease transaction, each of the Lender Parties hereby waives provisions of the Existing Revolving Credit Agreement and the Existing Acquisition Credit Agreement to the extent necessary to permit Genesis and/or one or more of its Subsidiaries to enter into, and perform its obligations under, the Synthetic Lease as set forth in the Outline of Terms of -7- the Synthetic Lease (Summary of Principal Terms and Conditions) dated 6/19/96 including, without limitation, the following: 1.7.1 Section 7.04 of Existing Revolving Credit Agreement and Section 6.04 of the Existing Acquisition Credit Agreement (respecting limitations on certain guarantees); 1.7.2 Section 7.16 of the Existing Revolving Credit Agreement and Section 6.16 of the Existing Acquisition Credit Agreement (respecting limitations on entering into agreements restricting the creation of Liens); and 1.7.3 Section 7.10 of the Existing Revolving Credit Agreement and Section 6.10 of the Existing Acquisition Agreement (respecting limitations on dispositions). II. Amendments and Waivers to Other Loan Documents 2.1 Synthetic Lease Collateral. It is understood that the Synthetic Lease obligations are expected to be secured by, among other things, a security interest in certain assets of the lessee or lessees and any sublessees and a pledge of the stock or other ownership interests of certain or substantially all of the Subsidiaries of Genesis. Notwithstanding anything set forth in the Collateral Agency Agreement or any Shared Security Document to the contrary, -8- each of the Shared Obligors may pledge any such collateral, including the stock or other ownership interests, to secure its obligations (including, without limitation, any guaranty obligations) under the Synthetic Lease and any such provisions to the contrary are hereby waived. 2.2 Sharing of Stock Collateral. To the extent that the stock and other ownership interests (together with proceeds) so pledged to the lessor and Persons funding with debt or equity the acquisition of the facilities subject to the Synthetic Lease (collectively, the "Lease Obligees") constitutes Shared Collateral previously pledged to the Secured Parties, such collateral (the "Joint Stock Collateral") shall be held by the Collateral Agent as agent for both the Secured Parties and the Lease Obligees on an equal and ratable basis and any distributions of the Joint Stock Collateral (but not other Collateral) after an Event of Default shall be made by the Collateral Agent on a pro rata basis to both the Secured Parties and the Lease Obligees based on the then outstanding amount of the obligations secured thereby. It is understood that no credit enhancement under or respecting the Synthetic Lease other than the pledge of the stock and the other ownership interests (together with proceeds thereof) shall be shared with the Secured Parties. 2.3 Amendments and Waivers. The undersigned recognize that the Collateral Agency Agreement and certain Shared Security Documents must be modified to provide for the sharing of the Joint Stock Collateral with the Lease Obligees. Accordingly, the Collateral Agent, the ACA Agent and the RCA Agent are hereby authorized and directed by each of the undersigned Secured Parties to -9- enter into such amendments, waivers, and modifications to the Collateral Agency Agreement and any Shared Security Documents and any supplemental instruments and agreements as may be consistent with the purposes set forth in the preceding Section 2.2 including, without limitation, an amendment to Section 4.04 of the Collateral Agency Agreement to provide for the pro rata distributions with respect to the Joint Stock Collateral (based on the then outstanding amount of the obligations secured thereby) and an amendment to Section 6.01 of the Collateral Agency Agreement to provide that an agent or representative of the Lease Obligees shall be entitled to similar voting rights as the ACA Agent and the RCA Agent under the Shared Security Documents on matters affecting the Joint Stock Collateral. It shall not be necessary for the consent of the Secured Parties under this Section 2.3 to approve the particular form of any proposed amendment, supplement or waiver, but it shall be sufficient if such consent approves the substance thereof. III. Conditions and Effectiveness ---------------------------- 3.1 Conditions Precedent to Effectiveness. The amendments and waivers set forth above shall become effective, as of the date first above written, upon the satisfaction of the following conditions precedent: -10- 3.1.1 Execution of Amendment and Waiver. The Borrowers, the Collateral Agent and the Agent shall have executed and delivered this Amendment and Waiver and the necessary Lenders shall have executed the Consent set forth below following the signature lines of the Borrowers and Agent. 3.1.2 Additional Matters. The Agent shall have received such other certificates, opinions, documents and instruments as may be reasonably requested by the Agent. All corporate and other proceedings, and all documents, instruments and other matters in connection with the transactions contemplated by this Amendment, the other Loan Documents (as defined in the Revolving Credit Agreement) or the other Loan Documents (as defined in the Acquisition Credit Agreement) shall be satisfactory in form and substance to the Agent. IV. Miscellaneous ------------- 4.1 Representations and Warranties. The Borrowers hereby represent and warrant to each Lender Party that all of the representations and warranties contained in Article 4 of the Revolving Credit Agreement, all of the representations and warranties contained in Article 3 of the Acquisition Credit Agreement and all of the representations and warranties contained in Article 4 of the Security Agreement, in each case after giving effect to the supplementation previously made pursuant to Section 5.01(a) of the Security Agreement and after giving effect to the amendments and waivers to be made hereby, are true in all material respects on and as of the date hereof with the -11- same effect as though made on and as of the date hereof. Further, the Borrowers hereby represent and warrant to each Lender Party that, both before and after giving effect to the amendments and waivers set forth above, no condition or event which constitutes an Event of Default or Potential Default (as such terms are defined in the Revolving Credit Agreement) or an Event of Default or Potential Default (as such terms are defined in the Acquisition Credit Agreement) exists or has occurred and is continuing. 4.2 Effect of Amendments. The Existing Revolving Credit Agreement, the Existing Acquisition Credit Agreement and each Loan Document, in each case as previously supplemented and as amended or modified by this Amendment and Waiver, are in all respects ratified, approved and confirmed and shall, as so supplemented and amended, remain in full force and effect. From and after the effective date hereof, all references in any document or instrument to the Revolving Credit Agreement, the Acquisition Credit Agreement or the Collateral Agency Agreement or any other Loan Document, as the case may be, shall mean the Existing Revolving Credit Agreement as previously supplemented and as amended by this Amendment and Waiver, the Existing Acquisition Credit Agreement as previously supplemented and as amended by this Amendment and Waiver or the existing Collateral Agency Agreement or other Loan Document as previously supplemented and as amended by this Amendment and Waiver, respectively (unless the context clearly requires otherwise). -12- 4.3 Governing Law. This Amendment and Waiver shall be governed by and shall be interpreted and enforced in accordance with the laws of the Commonwealth of Pennsylvania, without regard to choice of law principles. 4.4 Headings. The section and other headings contained in this Amendment and Waiver are for reference purposes only and shall not control or affect the construction or interpretation of this Amendment and Waiver in any respect. 4.5 Counterparts. This Amendment and Waiver may be executed in any number of counterparts and by the different parties hereto on separate counterparts, each of which counterparts, when so executed and delivered, shall be deemed to be an original, and all of which counterparts, taken together, shall constitute but one and the same instrument. IN WITNESS WHEREOF, the parties hereto, by their duly authorized officers thereunto duly authorized, have executed and delivered this Agreement as of the date first above written. ATTEST: GENESIS HEALTH VENTURES, INC. a Pennsylvania corporation By By --------------------------------- -------------------------------------- Title: Secretary Title: Senior Vice President and Chief Financial Officer -13- PROFESSIONAL PHARMACY SERVICES, INC., a Maryland Corporation MEDICAL SERVICES GROUP, INC., a Maryland Corporation CARECARD, INC., a Maryland Corporation TRANSPORT SERVICES, INC., a Maryland Corporation NEIGHBORCARE PHARMACIES, INC., a Maryland Corporation GENESIS HEALTH VENTURES, INC., a Pennsylvania corporation BREVARD MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Health, Inc., a Pennsylvania corporation, its sole general partners CATONSVILLE MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Health, Inc., a Pennsylvania corporation, one of its general partners EASTON MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Health, Inc., a Pennsylvania corporation, its sole general partner EDELLA STREET ASSOCIATES, a Pennsylvania limited partnership By: Genesis Health Ventures of Clarks Summit, Inc., its sole general partner GENESIS HEALTH VENTURES OF ARLINGTON, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF BLOOMFIELD, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF CLARKS SUMMIT, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF INDIANA, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF MASSACHUSETTS, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF NAUGATUCK, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF SALISBURY, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF WAYNE, INC., a Pennsylvania corporation GENESIS HEALTH VENTURES OF WEST VIRGINIA, INC., a Pennsylvania corporation -14- GENESIS HEALTH VENTURES OF WINDSOR, INC., a Pennsylvania corporation GENESIS IMMEDIATE MED CENTER, INC., a Pennsylvania corporation GENESIS MANAGEMENT RESOURCES, INC., a Pennsylvania corporation GENESIS ELDERCARE HOME CARE SERVICES, INC., a Pennsylvania corporation GENESIS ELDERCARE PHYSICIANS SERVICES, INC., a Pennsylvania corporation GENESIS PROPERTIES LIMITED PARTNERSHIP, a Pennsylvania limited partnership By: Genesis Health Ventures of Arlington, Inc., its sole general partner GREENSPRING MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Healthcare, Inc., a Pennsylvania corporation, its sole general partner HALLMARK HEALTHCARE LIMITED PARTNERSHIP, a Maryland limited partnership By: Pharmacy Equities, Inc., a Pennsylvania corporation, its sole general partner HAMMONDS LANE MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Healthcare, Inc., a Pennsylvania corporation, one of its general partners HEALTHCARE RESOURCES CORP., a Pennsylvania corporation KNOLLWOOD MANOR, INC., a Pennsylvania corporation MERIDIAN/CONSTELLATION LIMITED PARTNERSHIP By: Meridian Healthcare, Inc., general partner MERIDIAN EDGEWOOD LIMITED PARTNERSHIP By: Meridian Healthcare, Inc., a general partner MERIDIAN HEALTH, INC., a Pennsylvania corporation MERIDIAN HEALTHCARE, INC., a Pennsylvania corporation MERIDIAN PERRING LIMITED PARTNERSHIP By: Meridian Healthcare, Inc., a general partner MERIDIAN VALLEY LIMITED PARTNERSHIP By: Meridian Healthcare, Inc., a general partner -15- MERIDIAN VALLEY VIEW LIMITED PARTNERSHIP By: Meridian Healthcare, Inc., a general partner MILLVILLE MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Healthcare, Inc., a Pennsylvania corporation, its sole general partner PHARMACY EQUITIES, INC., a Pennsylvania corporation PHILADELPHIA AVENUE ASSOCIATES, a Pennsylvania limited partnership By: Philadelphia Avenue Corp., its sole general partner PHILADELPHIA AVENUE CORPORATION, a Pennsylvania corporation RIVER STREET ASSOCIATES, a Pennsylvania limited partnership By: Genesis Health Ventures of Wilkes-Barre, Inc., its sole general partner SEMINOLE MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Health, Inc., a Pennsylvania corporation, its sole general partner GENESIS ELDERCARE STAFFING SERVICES INC. a Pennsylvania corporation STATE STREET ASSOCIATES, L.P., a Pennsylvania limited partnership By: Genesis Health Ventures, Inc., its sole general partner STATE STREET ASSOCIATES, INC., a Pennsylvania corporation SUBURBAN MEDICAL SERVICES, INC. a Pennsylvania corporation GENESIS ELDERCARE REHABILITATION SERVICES, INC., a Pennsylvania corporation THERAPY CARE INC., a Pennsylvania corporation THERAPY CARE SYSTEMS, L.P. a Pennsylvania limited partnership By: Team Rehabilitation, Inc., its sole general partner THE TIDEWATER HEALTHCARE SHARED SERVICES GROUP, INC., a Pennsylvania corporation VOLUSIA MERIDIAN LIMITED PARTNERSHIP, a Maryland limited partnership By: Meridian Health, Inc., a Pennsylvania corporation, its sole general partner WYNCOTE HEALTHCARE CORP., a Pennsylvania corporation ASCO HEALTHCARE, INC., a Maryland corporation -16- BRINTON MANOR, INC., a Delaware corporation CONCORD HEALTHCARE CORPORATION, a Delaware corporation CRYSTAL CITY NURSING CENTER, INC., a Maryland corporation EASTERN MEDICAL SUPPLIES, INC., a Maryland corporation EASTERN REHAB SERVICES, INC., a Maryland corporation GENESIS HEALTH SERVICES CORPORATION, a Delaware corporation GENESIS HEALTHCARE CENTERS HOLDINGS, INC., a Delaware corporation GENESIS HOLDINGS, INC., a Delaware corporation GENESIS PROPERTIES OF DELAWARE CORPORATION, a Delaware corporation GENESIS PROPERTIES OF DELAWARE LTD PARTNERSHIP, L.P., a Delaware limited partnership By: Genesis Properties of Delaware Corporation, a general partner GOVERNOR'S HOUSE NURSING HOME, INC., a Delaware corporation HEALTH CONCEPTS AND SERVICES, INC., a Maryland corporation HILLTOP HEALTH CARE CENTER, INC., a Delaware corporation KEYSTONE NURSING HOME, INC., a Delaware corporation LINCOLN NURSING HOME, INC., a Delaware corporation McKERLEY HEALTH CARE CENTERS, INC., a New Hampshire corporation McKERLEY HEALTH CARE CENTER- CONCORD, INC., a New Hampshire corporation McKERLEY HEALTH CARE CENTER- CONCORD LIMITED PARTNERSHIP, a New Hampshire limited partnership By: McKerley Health Care Center- Concord, Inc., a New Hampshire corporation, its general partner McKERLEY HEALTH FACILITIES, a New Hampshire general partnership By: Meridian Health, Inc., a Pennsylvania corporation, and Meridian Healthcare, Inc., a Pennsylvania corporation, its general partners -17- WAYSIDE NURSING HOME, INC., a Delaware corporation ATTEST: By: By: ---------------------------------- -------------------------------- On behalf of each of the foregoing as Title: Secretary Senior Vice President and Chief Financial Officer -18- MELLON BANK, N.A., as RCA Agent, as ACA Agent and as Collateral Agent By --------------------------------- Title: Vice President AS OF THE DATE FIRST ABOVE WRITTEN, THE FOLLOWING INSTITUTIONS, AS THE LENDERS UNDER THE REVOLVING CREDIT AGREEMENT REFERENCED ABOVE, AND AS THE LENDERS UNDER THE ACQUISITION CREDIT AGREEMENT REFERENCED ABOVE, CONSENT TO THE FOREGOING SECOND AMENDMENT WAIVER TO LOAN DOCUMENTS AND DIRECT THE AGENT TO ENTER INTO THE SAME: MELLON BANK, N.A., as a Lender FLEET NATIONAL BANK (formerly under the Revolving Credit Agreement known as FLEET BANK OF and as a Lender under the Acquisition MASSACHUSETTS, N.A.) Credit Agreement By By ------------------------------------- --------------------------------- Title: Vice President Title CITIBANK, N.A. MERIDIAN BANK By By -------------------------------------- --------------------------------- Title: Title: FIRST UNION NATIONAL BANK OF FLEET BANK, N.A. (formerly known as NORTH CAROLINA NATWEST BANK N.A.) By By -------------------------------------- --------------------------------- Title: Title: NATIONSBANK, N.A. LTCB TRUST COMPANY By By -------------------------------------- --------------------------------- Title: Title: -19- CREDITANSTALT-BANKVEREIN By -------------------------------------- Title: Gregory F. Mathis Vice President By -------------------------------------- Title: Stacy Harmon Senior Associate SIGNET BANK/MARYLAND By -------------------------------------- Title: PNC BANK, NATIONAL ASSOCIATION By -------------------------------------- Title: TORONTO DOMINION (NEW YORK), INC. By -------------------------------------- Title: THE FIRST NATIONAL BANK OF MARYLAND By -------------------------------------- Title: -20-