1 Exhibit 10.2 SECOND AMENDMENT TO CREDIT AGREEMENT AND GUARANTY SECOND AMENDMENT TO CREDIT AGREEMENT AND GUARANTY dated as of April 16, 1997 (the "Second Amendment") among HEALTH MANAGEMENT SYSTEMS, INC. (the "Borrower"), ACCELERATED CLAIMS PROCESSING, INC. ("ACP"), QUALITY MEDI- CAL ADJUDICATION, INCORPORATED ("QMA"), HEALTH CARE MICROSYSTEMS, INC. ("HCM"), CDR ASSOCIATES INC. ("CDR"), and THE CHASE MANHATTAN BANK (the "Bank"). PRELIMINARY STATEMENT. The Borrower, ACP, QMA, HCM, CDR and the Bank have entered into a Credit Agreement and Guaranty dated as of July 15, 1996, as amended by First Amendment to Credit Agreement and Guaranty dated as of September 9, 1996 (as it may be further amended, supplemented or modified, the "Credit Agreement"). Any term used herein and not otherwise defined herein shall have the meaning assigned to such term in the Credit Agreement. The Borrower, ACP, QMA, HCM, CDR and the Bank have agreed to amend the Credit Agreement as hereinafter set forth. SECTION 1. Amendment to Credit Agreement. The Credit Agreement is, effective as of the date hereof and subject to the satisfaction of the conditions precedent set forth in Section 2 hereof, hereby amended as follows: (a) The following definitions shall be added in its proper alphabetical order: "Nagelhout Guaranty" means the Guaranty dated April 16, 1997 pursuant to which the Borrower guarantees a One Million Six Hundred Thousand Dollar ($1,600,000) loan made by the Bank to Mr. Robert V. Nagelhout. "Second Amendment" means the Second Amendment to Credit Agreement and Guaranty dated as of April 16, 1997 among the Borrower, each of the Guarantors and the Bank. (b) The definition of "Revolving Credit Facility" is amended by inserting at the end thereof the following: "less the principal amount of indebtedness outstanding under the promissory note dated April 16, 1997 made by Robert V. Nagelhout in favor of the Bank" 2 (c) Section 8.07 Guaranties, Etc. is amended by inserting after the word "Date" in the last line thereof the following: "and (4) Nagelhout Guaranty" (d) Section 10.01 Events of Default is amended by inserting after paragraph (9) the following: "(10) The Borrower shall fail to pay any obligations owing to the Bank when due and payable under the Nagelhout Guaranty, the Borrower shall fail to observe any term, covenant or agreement contained in such Guaranty on its part to be performed or observed, or such Guaranty shall any time after its execution and delivery and for any reason cease to be in full force and effect or shall be declared null and void, or the validity or enforceability thereof shall be contested by the Borrower, or the Borrower shall deny it has any further liability or obligation under such Guaranty, or the Borrower shall fail to perform any of its obligations under such Guaranty; or any representation or warranty made by the Borrower in such Guaranty shall prove to have been incorrect in any material respect on the date made;" SECTION 2. Condition of Effectiveness. This Second Amendment shall become effective as of the date on which each of the following conditions have been fulfilled: (1) Second Amendment. The Borrower, ACP, QMA, HCM, CDR and the Bank shall each have executed and delivered this Second Amendment; (2) Nagelhout Guaranty. The Borrower shall have executed and delivered the Nagelhout Guaranty; (3) Evidence of All Corporate Action by Borrower. The Bank shall have received a certificate of the Secretary or Assistant Secretary of the Borrower (dated as of the date of this Second Amendment) attesting to all corporate action taken by the Borrower including resolutions of its Board of Directors, authorizing the execution, delivery, and performance of this Second Amendment, the Nagelhout Guaranty and each other document to be delivered pursuant to or in connection with this Second Amendment or the Nagelhout Guaranty. SECTION 3. Reference to and Effect on the Loan Documents. (a) Upon the effectiveness of Section 1 hereof, on and after the date hereof each reference in the Credit Agreement to "this Agreement", "hereunder", "hereof", "herein" or words of like import, and each reference in the other Loan Documents to the Credit Agreement, shall mean and be a reference to the Credit Agreement as amended hereby. 2 3 (b) Except as specifically amended above, the Credit Agreement and all other Loan Documents shall remain in full force and effect and are hereby ratified and confirmed. (c) The execution, delivery and effectiveness of this Second Amendment shall not operate as a waiver of any right, power or remedy of the Bank under any of the Loan Documents, nor constitute a waiver of any provision of any of the Loan Documents, and, except as specifically provided herein, the Credit Agreement and each other Loan Document shall remain in full force and effect and are hereby ratified and confirmed. SECTION 4. Costs, Expenses and Taxes. The Borrower agrees to reimburse the Bank on demand for all out-of-pocket costs, expenses and charges (including, without limitation, all fees and charges of legal counsel for the Bank) incurred by the Bank in connection with the preparation, reproduction, execution and delivery of this Second Amendment and any other instruments and documents to be delivered hereunder. In addition, the Borrower shall pay any and all stamp and other taxes and fees payable or determined to be payable in connection with the execution and delivery, filing or recording of this Second Amendment and the other instruments and documents to be delivered hereunder, and agrees to save the Bank harmless from and against any and all liabilities with respect to or resulting from any delay in paying or omission to pay such taxes or fees. SECTION 5. Governing Law. This Second Amendment shall be governed by and construed in accordance with the laws of the State of New York. SECTION 6. Headings. Section headings in this Second Amendment are included herein for convenience of reference only and shall not constitute a part of this Second Amendment for any other purpose. SECTION 7. Counterparts. This Second Amendment may be executed in any number of counterparts, all of which taken together shall constitute one and the same instrument, and any party hereto may execute this Second Amendment by signing any such counterpart. 3 4 IN WITNESS WHEREOF, the parties hereto have caused this Second Amendment to be duly executed as of the day and year first above written. HEALTH MANAGEMENT SYSTEMS, INC. By____________________________________ Name: Title: ACCELERATED CLAIMS PROCESSING, INC. By____________________________________ Name: Title: QUALITY MEDI-CAL ADJUDICATION, INCORPORATED By____________________________________ Name: Title: HEALTH CARE MICROSYSTEMS, INC. By____________________________________ Name: Title: CDR ASSOCIATES, INC. By____________________________________ Name: Title: THE CHASE MANHATTAN BANK By____________________________________ Name: Title: 4