EXHIBIT 10.40

--------------------------------------------------------------------------------
                         TENTH AMENDMENT TO WAREHOUSING
                    CREDIT, TERM LOAN AND SECURITY AGREEMENT
--------------------------------------------------------------------------------

THIS TENTH AMENDMENT TO WAREHOUSING CREDIT, TERM LOAN AND SECURITY AGREEMENT
(this "Amendment") is entered into as of December 31, 2002, by and between
COLUMBIA NATIONAL, INCORPORATED, a Maryland corporation ("CNI"), AMERICAN HOME
MORTGAGE CORP., a New York corporation ("AHMC") (CNI and AHMC are collectively
referred to as "Borrower") RESIDENTIAL FUNDING CORPORATION, a Delaware
corporation ("RFC"), U.S. BANK NATIONAL ASSOCIATION ("U.S. Bank"), ALLFIRST BANK
("Allfirst Bank"), FLEET NATIONAL BANK ("Fleet"), CREDIT LYONNAIS NEW YORK
BRANCH ("Credit Lyonnais"), GUARANTY BANK, F.S.B. ("Guaranty"), NATIONAL CITY
BANK OF KENTUCKY ("National City") and COLONIAL BANK ("Colonial") (RFC, U.S.
Bank, Allfirst Bank, Fleet, National City, Credit Lyonnais, Guaranty, Colonial,
and any Additional Lender as may from time to time become a party hereto and
their respective successors and permitted assigns being referred to individually
as a "Lender" and collectively as the "Lenders"), and RFC as credit agent for
the Lenders (in such capacity, the "Credit Agent"), and U.S. Bank, as collateral
agent for the Credit Agent and the Lenders ("Collateral Agent").

WHEREAS, CNI, Credit Agent and Collateral Agent have entered into a single
family revolving warehouse facility and a term loan facility, as evidenced by a
Warehousing Credit, Term Loan and Security Agreement (Syndicated Loan Agreement)
dated as of May 3, 2001, by and among the Borrower, the Lenders named therein,
the Collateral Agent and the Credit Agent, as the same has been amended,
supplemented or otherwise modified from time to time (the "Agreement"); and

WHEREAS, CNI has requested that Lenders consent to the addition of AHMC as a
Borrower under the Agreement and amend certain other terms of the Agreement, and
Lenders, other than National City and Guaranty, have agreed to such addition of
AHMC as a Borrower and amendment of the Agreement, subject to the terms and
conditions of this Amendment; and

WHEREAS, Borrower has requested an extension of the temporary increase in the
Warehousing Credit Limit to $450,000,000 and Lenders have agreed to such
extension of the temporary increase, subject to the terms and conditions of this
Amendment.

NOW, THEREFORE, for and in consideration of the foregoing and of the mutual
covenants, agreements and conditions hereinafter set forth and for other good
and valuable consideration, the receipt and sufficiency of which are hereby
acknowledged, the parties hereto hereby agree as follows:

1) Subject to the satisfaction of the conditions set forth in Section 13, the
effective date ("Effective Date") of this Amendment shall be ______________,
2002.

2) All capitalized terms used herein that are not otherwise defined below are
defined in the Agreement.

3) Article 1 of the Agreement is amended to add the following section
immediately following Section 1.9:

      1.10  JOINT AND SEVERAL LIABILITY

      Advances shall be made to either Borrower (except to the extent otherwise
      provided herein), as shall be requested in the Advance Request, but each
      Advance, regardless of which Borrower it is made to, shall be deemed made
      to or for the benefit of both Borrowers, and each Borrower jointly and
      severally shall be obligated to repay all Advances. With respect to its
      obligation to repay Advances made to the other Borrower, each Borrower
      agrees to the terms set forth in Exhibit Q.

4) Section 8.12 of the Agreement is deleted in its entirety and the following is
substituted in lieu thereof:

      8.12  OTHER LOAN OBLIGATIONS

      Perform all material obligations under the terms of each loan agreement,
      note, mortgage, security agreement or debt instrument by which Borrower is
      bound or to which any of its property is subject, and promptly notify
      Credit Agent in writing of a declared default under or the termination,
      cancellation, reduction or nonrenewal of any of its other lines of credit
      or agreements with any other lender. Exhibit F is a true and complete list
      of all such lines of credit or agreements as of the date of this
      Agreement. Borrower must give Credit Agent Notice before entering into any
      additional lines of credit or agreements.

5) Sections 9.2, 9.3 9.6, 9.7, 9.8, 9.9, 9.10, 9.14, 9.15 and 9.17 of the
Agreement are deleted in their entirety and the following are substituted in
lieu thereof:

       9.2    LIMITATION ON LIENS

      Pledge or grant a security interest in any existing or future Servicing
      Contracts of Borrower other than to Lender; or omit to take any action
      required to keep all of Borrower's Servicing Contracts in full force and
      effect.

       9.3    RESTRICTIONS ON FUNDAMENTAL CHANGES


              9.3(a) Consolidate, merge or enter into any analogous
                     reorganization or transaction with any Person, unless such
                     other Person is engaged in the mortgage banking business
                     and Borrower is the surviving entity.

              9.3(b) Liquidate, wind up or dissolve (or suffer any liquidation
                     or dissolution).

              9.3(c) Cease actively to engage in the business of originating,
                     acquiring or servicing Mortgage Loans or make any other
                     material change in the nature or scope of the business in
                     which Borrower engages as of the date of this Agreement.

              9.3(d) Sell, assign, lease, convey, transfer or otherwise dispose
                     of (whether in one transaction or a series of transactions)
                     all or any substantial part of Borrower's business or
                     assets, whether now owned or acquired after the Closing
                     Date, other than, in the ordinary course of business and to
                     the extent not otherwise prohibited by this Agreement,
                     sales of (1) Mortgage Loans, (2) Mortgage-backed Securities
                     and (3) Servicing Contracts.

              9.3(e) Acquire by purchase or in any other transaction all or
                     substantially all of the business or property of, or stock
                     or other ownership interests of, any Person, unless such
                     Person is engaged in the mortgage banking business and,
                     after giving effect to such acquisition or purchase, no
                     Default or Event of Default will have occurred and be
                     continuing.

              9.3(f) Change its jurisdiction of incorporation or formation,
                     without the prior written consent of the Majority Lenders,
                     which will not be unreasonably withheld.

              9.3(g) Permit any Subsidiary of Borrower to do or take any of the
                     foregoing actions.

       9.6    NET INCOME OF GUARANTOR

       Permit the net income of Guarantor and its Subsidiaries, on a
       consolidated basis, to be less than zero for any period of 6 consecutive
       months.

       9.7    ADJUSTED TANGIBLE LEVERAGE RATIO

       Permit Guarantor's Adjusted Tangible Leverage Ratio at any time to exceed
       12 to 1.

       9.8    MINIMUM BOOK NET WORTH

       Permit Guarantor's Book Net Worth at any time to be less than
       $115,000,000.

       9.9    MINIMUM ADJUSTED TANGIBLE NET WORTH

       Permit Guarantor's Adjusted Tangible Net Worth at any time to be less
       than $70,000,000.

       9.10   [INTENTIONALLY OMITTED.]

       9.14   [INTENTIOANLLY OMITTED.]

       9.15   TRANSACTIONS WITH AFFILIATES

       Directly or indirectly (a) make any loan, advance, extension of credit or
       capital contribution to any of Borrower's Affiliates, other than
       Guarantor and its Subsidiaries, (b) sell, transfer, pledge or assign any
       of its assets to or on behalf of those Affiliates, other than Guarantor
       and its Subsidiaries, (c) merge or consolidate with or purchase or
       acquire assets from those Affiliates, other than Guarantor and its
       Subsidiaries, or (d) pay management fees to or on behalf of those
       Affiliates.

       9.17   DEFERRAL OF SUBORDINATED DEBT

       (a) Pay any Subordinated Debt of Borrower in advance of its stated
       maturity, except for prepayments in an aggregate amount not to exceed
       $75,000; (b) after a Default or Event of Default under this Agreement has
       occurred, make any payment of any kind on any Subordinated Debt of
       Borrower until all of the Obligations have been paid and performed in
       full and any applicable preference period has expired.

6) Section 11.1(o) of the Agreement is deleted in its entirety.

7) Section 11.4 of the Agreement is deleted in its entirety and the following is
substituted in lieu thereof:

       11.4   CREDIT AGENT AND COLLATERAL AGENT APPOINTED ATTORNEY-IN-FACT

       Borrower appoints each of Credit Agent and Collateral Agent its
       attorney-in-fact, with full power of substitution, for the purpose of
       carrying out the provisions of this Agreement, the Notes and the other
       Loan Documents and taking any action and executing any instruments that
       Credit Agent or Collateral Agent deems necessary or advisable to
       accomplish that purpose. Borrower's appointment of Credit Agent and
       Collateral Agent as attorney-in-fact is irrevocable and coupled with an
       interest. Without limiting the generality of the foregoing, Credit Agent
       or Collateral Agent may give notice of Credit Agent's Lien on the
       Collateral to any Person, either in the name of Borrower or in its own
       name, endorse all Pledged Loans or Pledged Securities payable to the
       order of Borrower, execute and/or record assignments of Mortgages
       (including, without limitation, Mortgages naming Mortgage Electronic
       Registration Systems, Inc. ("MERS") as mortgagee) securing Pledged Loans,
       notify MERS to change the registration of any Mortgage securing a Pledged
       Loan on the MERS System, change or cause to be changed the book-entry
       registration or name of subscriber or Investor on any Pledged Security,
       or receive, endorse and collect all checks made payable to the order of
       Borrower representing payment on account of the principal of or interest
       on, or the proceeds of sale of, any of the Pledged Loans or Pledged
       Securities and give full discharge for those transactions.

8) Section 14.1 of the Agreement is amended to add the following definition in
the appropriate alphabetical order:

       "AHMC" means American Home Mortgage Corporation, a New York corporation.

       "Borrower" means AHMC and CNI, individually (as the context may require).

       "CNI" means Columbia National Incorporated, a Maryland corporation.

       "Majority Lenders" means at any date the Lenders holding not less than
       (a) from the Effective Date to and including March 17, 2003, 75%, and (b)
       thereafter, 66-2/3%, of the aggregate Credit Limit. Notwithstanding the
       foregoing, if there are only 2 Lenders the term "Majority Lenders" shall,
       except for purposes of Section 11.2(c), include both of the Lenders.

9) Exhibits A-TL, A-WC, C, D, E, F, G, K, L and M to the Agreement are hereby
deleted in their entirety and replaced with the new Exhibits A-TL, A-WC, C, D,
E, F, G, K, L and M attached to this Amendment. All references in the Agreement
to Exhibits A-TL, A-WC, C, D, E, F, G, K, L and M will be deemed to refer to the
new Exhibits A-TL, A-WC, C, D, E, F, G, K, L and M.

10. The Agreement is amended by deleting Exhibits N and O in their entirety.

11. The Agreement is amended to add a new Exhibit Q attached hereto.

12. On the Effective Date, (a) each of RFC, Fleet and U.S. Bank shall make
Warehousing Advances or Term Loan Advances, as applicable, in the amount
required to cause the outstanding amount of such Advances to equal its
Percentage Share (after giving effect to this Amendment) of Warehousing Advances
or Term Loan Advances, as applicable, then outstanding, and such Advances shall
be used by Credit Agent to repay the outstanding Advances of National City and
Guaranty in full, and (b) Borrower shall pay all interest, fees and other
amounts, if any, due to National City and Guaranty under the Agreement as of the
Effective Date (the "Payoff Amount"). Upon the making of such Advances and the
payment of the Payoff Amount, (A) the Commitments of National City and Guaranty
under the Agreement shall terminate; (B) National City and Guaranty shall no
longer be parties to the Agreement; and (C) National City and Guaranty shall no
longer be deemed to be "Lenders" for any purpose under the Agreement.

13. On the Effective Date, Borrower will pay to each Increase Lender, pursuant
to this Amendment, a non-refundable Increase Fee, on the amount of the increase
of such Lender's Warehousing Commitment Amount or Term Loan Commitment Amount,
as applicable, in an amount equal to the percentage as calculated below:

      ----------------------------------------------------------------------
                     LENDER'S
            COMMITMENT AMOUNT INCREASE                INCREASE FEE %
      ----------------------------------------------------------------------
        Less than or equal to $10,000,000                  .04%
      ----------------------------------------------------------------------
             Greater than $10,000,000                      .06%
      ----------------------------------------------------------------------
                  > $25,000,000                            .09%
      ----------------------------------------------------------------------

14. On the Effective Date of this Amendment, Borrower shall deliver to Credit
Agent the following:

       a.     An executed original of this Amendment;

       b.     An executed Second Amendment to the Collateral Agreement;

       c.     First Amended and Restated Warehousing Promissory Notes payable to
              each Lender;

       d.     First Amended and Restated Term Loan Promissory Notes payable to
              each Lender;

       e.     First Amended and Restated Sublimit Promissory Note payable to
              each Lender;

       f.     First Amended and Restated Swingline Promissory Note payable to
              RFC;

       g.     Certificate of Secretary with Resolutions for each Borrower,
              including Articles of Incorporation, Bylaws and Certificates of
              Good Standing for AHMC;

       h.     A current certified tax lien and judgment search of the
              appropriate public records for AHMC, including a search of Uniform
              Commercial Code financing statements, which search will not have
              disclosed the existence of any prior Lien on the Collateral other
              than in favor of Lender or as permitted hereunder;

       i.     Current insurance information for AHMC;

       j.     Opinion of Counsel with respect to AHMC;

       k.     Payment of an invoice from Mortgage Dynamics, Inc. in the amount
              of $5,088.65 dated November 20, 2002, for professional fees
              rendered in connection with an operations review of AHMC;

       l.     A $3,000 legal documentation fee; and

       m.     Amendment fees as required under Section 13.8(b) of the Agreement.

15. Borrower represents, warrants and agrees that a) there exists no Default or
Event of Default under the Loan Documents, b) the Loan Documents continue to be
the legal, valid and binding agreements and obligations of Borrower enforceable
in accordance with their terms, as modified herein, c) Lender is not in default
under any of the Loan Documents and Borrower has no offset or defense to its
performance or obligations under any of the Loan Documents, d) the
representations contained in the Loan Documents remain true and accurate in all
respects and e) there has been no material adverse change in the financial
condition of Borrower from the date of the Agreement to the date of this
Amendment.

16. Except as hereby expressly modified, the Agreement shall otherwise be
unchanged and shall remain in full force and effect, and Borrower ratifies and
reaffirms all of its obligations thereunder.

17. This Amendment may be executed in any number of counterparts and by the
different parties hereto on separate counterparts, each of which when so
executed and delivered shall be an original, but all of which shall together
constitute one and the same instrument.

IN WITNESS WHEREOF, Borrower, Lenders, Credit Agent and Collateral Agent have
caused this Amendment to be duly executed on their behalf by their duly
authorized officers as of the day and year above written.


                                            BORROWERS:

                                            COLUMBIA NATIONAL, INCORPORATED,
                                            a Maryland corporation

                                            By: /s/ Mark C. Krebs
                                               -----------------------------

                                            Its: Senior Vice President/Treasurer
                                                ----------------------------
<PAGE>


                                            AMERICAN HOME MORTGAGE CORP.,
                                            a New York corporation

                                            By: /s/ Richard Silver
                                               ---------------------------------

                                            Its: Senior Vice President/Treasurer
                                                --------------------------------
<PAGE>


                                                CREDIT AGENT:

                                                RESIDENTIAL FUNDING CORPORATION,
                                                a Delaware corporation

                                                By:  /s/ Sam Bryan
                                                    ----------------------------

                                                Its: Director



                                                COLLATERAL AGENT:

                                                U.S. BANK NATIONAL ASSOCIATION,
                                                a national banking association


                                                By:  /s/ Edwin D. Jenkins
                                                    ----------------------------

                                                Its:  Senior Vice President
                                                     ---------------------------
<PAGE>


                                                LENDERS:

                                                RESIDENTIAL FUNDING CORPORATION,
                                                a Delaware corporation

                                                By:  /s/ Sam Bryan
                                                    ----------------------------

                                                Its: Director
<PAGE>


                                                U.S. BANK NATIONAL ASSOCIATION,
                                                a national banking association


                                                By:  /s/ Edwin D. Jenkins
                                                    ----------------------------

                                                Its:  Senior Vice President
                                                     ---------------------------
<PAGE>


                                                ALLFIRST BANK


                                                By:  /s/ Timothy S. Avendt
                                                    ----------------------------

                                                Its:  Vice President
                                                     ---------------------------



<PAGE>




                                                FLEET NATIONAL BANK

                                                By:  /s/ Stephen E. Burse
                                                    ----------------------------

                                                Its:  Vice President
                                                     ---------------------------



<PAGE>


                                                NATIONAL CITY BANK OF KENTUCKY

                                                By:  /s/ Mary Jo Reiss
                                                    ----------------------------

                                                Its:  Vice President
                                                     ---------------------------
<PAGE>


                                                CREDIT LYONNAIS NEW YORK BRANCH

                                                By:  /s/ Sebastian Rocco
                                                    ----------------------------

                                                Its:  Senior Vice President
                                                     ---------------------------
<PAGE>


                                                GUARANTY BANK, F.S.B.,
                                                a federal savings bank

                                                By:  /s/ Gregory S. Leftwich
                                                    ----------------------------

                                                Its:  Vice President
                                                     ---------------------------
<PAGE>


                                                COLONIAL BANK,
                                                an Alabama banking corporation

                                                By:  /s/ Amy J. Nunoz
                                                    ----------------------------

                                                Its:  Senior Vice President
                                                     ---------------------------