1
                                                                    EXHIBIT 10.2


                     THIRD AMENDMENT TO REPAYMENT AGREEMENT
                      AND SIXTH AMENDMENT TO LOAN AGREEMENT


         This Third Amendment to Repayment Agreement and Sixth Amendment to Loan
Agreement ("Third Amendment") is made as of the 23rd day of April, 1999, by and
among KEYBANK NATIONAL ASSOCIATION, f/k/a Society Bank, Michigan, a national
banking association located at 127 Public Square, Cleveland, Ohio 44114
("KeyBank" or "Bank"), NEMATRON CORPORATION, a Michigan corporation located at
5840 Interface Drive, Ann Arbor, Michigan 48103 ("Borrower") and NEMASOFT, INC.,
a Michigan corporation located at 5840 Interface Drive, Ann Arbor, Michigan
48103 ("Guarantor"; Borrower and Guarantor together referred to as "Interested
Parties").

                                    RECITALS

         WHEREAS, Bank and the Interested Parties executed a certain Repayment
Agreement dated as of September 28, 1998 ("Repayment Agreement"); and

         WHEREAS, Bank and the Interested Parties executed a certain First
Amendment to Repayment Agreement and Fourth Amendment to Loan Agreement dated as
of December 1, 1998 ("First Amendment") and a Second Amendment to Repayment
Agreement and Fifth Amendment to Loan Agreement dated as of January 31, 1999
("Second Amendment"); and

         WHEREAS, capitalized terms not otherwise defined herein shall have the
meanings ascribed thereto in the Repayment Agreement; and

         WHEREAS, the Interested Parties have request that Bank modify the
Repayment Agreement and the Loan Agreement to allow for the issuance of Standby
Letters of Credit from Bank in the maximum aggregate amount of Two Million
Dollars ($2,000,000), to which request Bank has acquiesced in the manner
described herein.

I.       AGREEMENT

         NOW, THEREFORE, in consideration of the foregoing, and the agreements
and covenants herein, the parties agree as follows:

         1. Recitals.  The Recitals are incorporated herein by reference.

         2. Restructure and Amendment of Loan Documents. Certain of the Loan
Documents shall be amended as follows:
            i)        Section 1 of the Repayment Agreement is amended by adding,
                      in appropriate alphabetical order, a new definition of
                      `Loan Agreement', and by deleting the existing definition
                      of `Original
   2

                      Loan Documents' and replacing it with a new definition, as
                      follows:

         "`Loan Agreement' shall have the meaning ascribed thereto in the
         Recitals, as such agreement may be further amended, or amended and
         restated, from time to time.

                  `Original Loan Documents' means all documents heretofore
                  executed in connection with the Original Notes, as well as all
                  documents evidencing leases of equipment by KCCI to any
                  Interested Party, and including all amendments of any thereof
                  and `Loan Documents' means the Repayment Agreement, any
                  amendment thereto and each of the documents required to be
                  executed and delivered to Bank in connection therewith, as
                  same may be amended from time to time, together with all of
                  the Original Loan Documents."

                      ii) Section 3 of the Repayment Agreement is amended by
                         inserting a new subsection (k) as follows:

                  "k) The Loan Agreement is amended by reinserting subsection
                      1.3 as follows:

                  1.3 LETTERS OF CREDIT

                      1.3.1 Upon the request of Borrower, made at any time
                  between April 23, 1999 and October 1, 1999, and so long as no
                  Event of Default under this Agreement has occurred or is
                  continuing, Bank shall issue a Letter of Credit expiring no
                  later than October 31, 1999 (by its terms or upon notice by
                  Bank to the Letter of Credit beneficiary) in such form as may
                  from time to time be approved by Bank in favor of such
                  beneficiaries as Borrower shall specify; provided that the
                  face amount of the Letter of Credit, when added to the
                  aggregate face amount of all other Letters of Credit
                  previously issued pursuant to this Agreement from time to time
                  shall not exceed Two Million Dollars ($2,000,000).

             1.3.2 The Obligations of Borrower with respect to a Letter of
         Credit shall be governed by the terms and conditions of a Standby
         Letter of Credit Application executed between Borrower and Bank (which,
         together with any similar replacement agreement subsequently executed
         by Borrower in connection with the Letter of Credit, is the
         "Application"). Borrower shall reimburse Bank for the amount of each
         draft presented under the Letter of Credit and paid by Bank and the
         amount of any taxes, fees, charges or other costs or expenses
         whatsoever incurred by Bank in connection with any payment made by Bank
         under, or with respect to, the Letters of Credit (the "Letter of Credit
         Obligation") as set forth in the Application.

                      1.3.3 To the extent that Borrower is eligible for a cash
                  advance under the Line of Credit, Borrower authorizes Bank to
   3




                  make an advance thereunder in an amount sufficient to
                  discharge Borrower's Letter of Credit Obligation as of the
                  date such obligation arises.

                      1.3.4 To the extent that Borrower is not eligible for a
                  cash advance under the Line of Credit pursuant to this
                  Agreement, Borrower shall immediately pay and discharge the
                  Letter of Credit Obligation pursuant to the terms of the
                  Application."

         3. Effective Date. The provisions of this Third Amendment shall be
effective on April 23, 1999 ("Effective Date"), provided that a fully executed
copy of this Third Amendment is delivered to Bank on or before April 23, 1999.

         4.Loan Documents. Any reference in any of the Loan Documents to the
Repayment Agreement or the Loan Agreement shall, from and after the Effective
Date, be deemed to refer to the Repayment Agreement and the Loan Agreement as
modified by this Third Amendment.

         5. Conflicting Terms; No Other Modification. To the extent that any of
the terms and conditions of this Third Amendment are inconsistent with the terms
of the Repayment Agreement, the conditions of this Third Amendment shall
prevail. Otherwise, unless expressly modified or superseded herein, all of the
terms and conditions of the Repayment Agreement are ratified and confirmed and
shall remain unaffected and in full force and effect.

         6. Course of Dealing. Interested Parties understand that the Loan
Documents will be strictly enforced going forward, and that Bank's failure to
insist on strict performance to date shall not be interposed as a defense to
Bank's exercise of its legal rights, nor shall it constitute a waiver of any
thereof.

         7. Release. Effective as of the date of the delivery of a fully
executed copy or original of this Third Amendment, the Interested Parties
jointly and severally agree to release and hereby do release and discharge, Bank
and KCCI, their respective shareholders, agents, servants, employees, directors,
officers, attorneys, affiliates, subsidiaries, successors and assigns and all
persons, firms, corporations, and organizations acting on their behalf ("Bank
Parties") of and from all damages, losses, claims, demands, liabilities,
obligations, actions and causes of action whatsoever that each Interested Party
has or claims to have against any Bank Party as of the date hereof and whether
known or unknown at the time of this release, and of every nature and extent
whatsoever on account of or in any way, directly or indirectly, touching,
concerning, arising out of or founded upon the Loan Documents, or the
relationship respecting any agreement between any Interested Party and any Bank
Party.

         8. Third-Party Beneficiaries/Entire Agreement. All the conditions and
obligations hereunder are imposed solely and exclusively for the benefit of the
parties hereto and their successors and assigns. No other person or entity shall
obtain any interest herein or require satisfaction of such conditions in
accordance with the terms hereof or be entitled to assume that any of the
parties hereto will enforce such conditions and obligations and no other person
shall, under any circumstances, be a beneficiary of such conditions. This Third
Amendment embodies the entire agreement and
   4



understanding between the parties hereto with respect to the subject matter of
this Third Amendment and supersedes all prior and contemporaneous negotiations,
agreements and understandings relative to such subject matter.

         9. Binding Effect; Governing Law. This Third Amendment shall bind and
inure to the benefit of the parties hereto and their respective successors and
assigns and shall be governed by and construed in accordance with the laws of
the State of Michigan without regard to principles of conflict of laws.

         10. Counterparts. This Third Amendment may be executed in any number of
counterparts, each of which, when so executed and delivered, shall be an
original and all of which counterparts together shall constitute one and the
same fully executed instrument.

         11. Consent and Reaffirmation of Guaranty. Guarantor, being guarantor
of the Obligations of Borrower pursuant to a Continuing Guaranty dated October
6, 1995, joins in and consents to the within Third Amendment and agrees that the
provisions of such guaranty are ratified and confirmed and that the guaranty
remains in full force and effect.

         12. Corporate Authority. Borrower and Guarantor hereby represent and
warrant to Bank that (a) Borrower and Guarantor have the legal power and
authority to execute and deliver this Third Amendment; (b) the officials
executing this Third Amendment have been duly authorized to execute and deliver
the same and bind Borrower and Guarantor with respect to the provisions hereof;
(c) the execution and delivery hereof by Borrower and Guarantor and the
performance and observance by Borrower and Guarantor of the provisions hereof do
not violate or conflict with the organizational agreements of Borrower or
Guarantor or any law applicable to Borrower or Guarantor or result in a breach
of any provision of or constitute a default under any other agreement,
instrument or document binding upon or enforceable against Borrower or
Guarantor; (d) this Third Amendment constitutes a valid and binding obligation
of Borrower and Guarantor in every respect, enforceable in accordance with its
terms.

         IN WITNESS WHEREOF, Interested Parties and Bank have caused this Third
Amendment to be executed by their duly authorized officers as of the date first
written above.

                                        NEMATRON CORPORATION
Address:

5840 Interface Drive                    By: /s/ David P. Gienapp           .
                                            --------------------------------
Ann Arbor, Michigan  48103              Its: V P- Finance and Administration
                                             -------------------------------


                                        NEMASOFT, INC., Guarantor
Address:

5840 Interface Drive                    By: /s/David P. Gienapp             .
                                            ---------------------------------
Ann Arbor, Michigan  48103              Its: Secretary                      .
                                             --------------------------------


   5



                                          KEYBANK NATIONAL ASSOCIATION
Address:

202 S. Michigan Street                    By:  /s/ Richard Rozenboom        .
P.O. Box 6                                     ------------------------------   
South Bend, Indiana  46601                Its: Vice President               .
                                               ------------------------------