EXECUTION

     

     

    

       

      GSR
        MORTGAGE LOAN TRUST 2007-5F

       

      MORTGAGE
        PASS-THROUGH CERTIFICATES

       

      SERIES
        2007-5F 

       

      


      MASTER
        SERVICING

       

       

      and

       

       

      TRUST
        AGREEMENT

       

       

      among

       

       

      GS
        MORTGAGE SECURITIES CORP.,

      as
        Depositor

       

       

      U.S.
        BANK NATIONAL ASSOCIATION,

      as
        Trustee and as a Custodian

      


       

      WELLS
        FARGO BANK, NATIONAL ASSOCIATION,

      as
        Master Servicer and Securities Administrator 

      


      and

      


       

      DEUTSCHE
        BANK NATIONAL TRUST COMPANY,

      as
        a Custodian

      


      


       

      Dated
        as of

       

      December
        1, 2007

       


      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      


      TABLE
        OF CONTENTS

       

      Page

      
        	
                ARTICLE
                  I. DEFINITIONS

              	
                1

              
	
                Section
                  1.01.

              	
                Standard
                  Terms.

              	
                1

              
	
                Section
                  1.02.

              	
                Defined
                  Terms.

              	
                2

              
	
                ARTICLE
                  II. FORMATION OF TRUST; CONVEYANCE OF MORTGAGE LOANS

              	
                14

              
	
                Section
                  2.01.

              	
                Conveyance
                  to the Trustee.

              	
                14

              
	
                Section
                  2.02.

              	
                Acceptance
                  by the Trustee and Securities Administrator.

              	
                15

              
	
                Section
                  2.03.

              	
                REMIC
                  Elections and REMIC Interests Designations.

              	
                16

              
	
                ARTICLE
                  III. REMITTING TO CERTIFICATEHOLDERS

              	
                17

              
	
                Section
                  3.01.

              	
                Distributions
                  to Certificateholders.

              	
                17

              
	
                Section
                  3.02.

              	
                Allocation
                  of Realized Losses and Shortfalls.

              	
                19

              
	
                ARTICLE
                  IV. THE SECURITIES

              	
                20

              
	
                Section
                  4.01.

              	
                The
                  Certificates.

              	
                20

              
	
                Section
                  4.02.

              	
                Denominations.

              	
                20

              
	
                Section
                  4.03.

              	
                Redemption
                  of Certificates.

              	
                21

              
	
                Section
                  4.04.

              	
                Securities
                  Laws Restrictions.

              	
                21

              
	
                ARTICLE
                  V. MISCELLANEOUS PROVISIONS

              	
                22

              
	
                Section
                  5.01.

              	
                Request
                  for Opinions.

              	
                22

              
	
                Section
                  5.02.

              	
                Schedules
                  and Exhibits.

              	
                22

              
	
                Section
                  5.03.

              	
                Governing
                  Law.

              	
                22

              
	
                Section
                  5.04.

              	
                Counterparts.

              	
                22

              
	
                Section
                  5.05.

              	
                Notices.

              	
                22

              


      

      



      
        
          
          

        

        
          i

          
            

          

        

        
          
          

        

      


      SCHEDULES
        AND EXHIBITS

      


      
        	
                Schedule
                  I

              	
                Mortgage
                  Loans

              
	 	 
	
                Schedule
                  II

              	
                [Reserved]

              
	 	 
	
                Schedule
                  III

              	
                [Reserved]

              
	 	 
	
                Exhibit
                  A

              	
                Forms
                  of Certificates

              


      

      

        
          
            
            

          

          
            ii

            
              

            

          

          
            
            

          

        



      MASTER
        SERVICING AND TRUST AGREEMENT

       

      THIS
        MASTER SERVICING AND TRUST AGREEMENT (this “Trust
        Agreement”),
        dated
        as of December 1, 2007, is hereby executed by and among GS MORTGAGE SECURITIES
        CORP., a Delaware corporation (the “Depositor”),
        U.S.
        BANK NATIONAL ASSOCIATION, as trustee (the “Trustee”)
        and as
        a custodian, DEUTSCHE BANK NATIONAL TRUST COMPANY, as a custodian (together
        with
        U.S. Bank National Association in its capacity as a custodian, the “Custodians”)
        and
        WELLS FARGO BANK, N.A., as securities administrator (in such capacity, the
        “Securities
        Administrator”)
        and
        master servicer (in such capacity, the “Master
        Servicer”).
        All
        of the provisions of the Standard Terms to Master Servicing and Trust Agreement
        (December 2007 Edition) (the “Standard
        Terms”),
        unless otherwise specified herein, are hereby incorporated herein by reference
        and shall be a part of this Trust Agreement as if set forth herein in
        full.

       

      PRELIMINARY
        STATEMENT

       

      The
        Board
        of Directors of the Depositor has duly authorized the formation of GSR Mortgage
        Loan Trust 2007-5F as a trust (the “Trust”)
        to
        issue a series of securities with an aggregate initial outstanding principal
        balance of $723,453,809 to be known as the Mortgage Pass-Through Certificates,
        Series 2007-5F (the “Certificates”).
        The
        Trust is formed by this Trust Agreement. The Certificates in the aggregate
        evidence the entire beneficial ownership in the Trust. The Certificates consist
        of the Classes set forth herein. 

       

      Pursuant
        to Section 12.01 of the Standard Terms, the Securities Administrator, on
        behalf
        of the Trustee, shall make an election to treat all of the Trust Estate as
        two
        real estate mortgage investment conduits (each, a “REMIC”
and,
        individually, “REMIC
        I”
and
        “REMIC
        II”)
        for
        federal income tax purposes. The “startup day” of each REMIC for purposes of the
        REMIC Provisions is the Closing Date.

       

      For
        purposes of naming the REMIC Interests and the Certificates, the letter (“A,”
“M” or “B”), refers to the status of the interest (“A” for senior or “M” or “B”
for subordinate) and the final character or characters (“1,” “2,” “3,” “4,” “5,”
“6,” “R” or “RC”) refers to the specific Class.

       

      NOW,
        THEREFORE, in consideration of the mutual promises, covenants, representations
        and warranties hereinafter set forth, the Depositor, the Trustee, the Securities
        Administrator, each Custodian and the Master Servicer agree as
        follows:

       

      ARTICLE
        I.

       

      DEFINITIONS

       

      Section
        1.01. Standard
        Terms.

       

      The
        Depositor, the Trustee, the Securities Administrator, the Custodians and
        the
        Master Servicer acknowledge that the Standard Terms prescribe certain
        obligations of each such entity with respect to the Certificates. The Depositor,
        the Trustee, the Securities Administrator, the Custodians and the Master
        Servicer agree to observe and perform such prescribed duties, responsibilities
        and obligations, pursuant to the terms and conditions thereof and of this
        Trust
        Agreement, except to the extent inconsistent with the provisions of this
        Trust
        Agreement, the Standard Terms are and shall be a part of this Trust Agreement
        to
        the same extent as if set forth herein in full.

       

       


      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      Section
        1.02. Defined
        Terms.

       

      Capitalized
        terms used but not defined herein shall have the respective meanings assigned
        to
        them in Section 1.01 of the Standard Terms or in the applicable Sale and
        Servicing Agreement. In the event of a conflict between the Standard Terms
        and
        the applicable Sale and Servicing Agreement, such Sale and Servicing Agreement
        shall govern. In the event of a conflict between the Standard Terms and this
        Trust Agreement, this Trust Agreement shall govern. In addition, the following
        provisions shall govern the defined terms set forth below for this Trust
        Agreement:

       

      “60+
        Day Delinquent Mortgage Loan”
means,
        (a) each Mortgage Loan with respect to which any portion of a scheduled payment
        is, as of the last day of the prior Due Period, two (2) months or more past
        due
        (without giving effect to any grace period), (b) each Mortgage Loan in
        foreclosure, (c) all REO Property, (d) each Mortgage Loan for which the related
        mortgagor has filed for bankruptcy, (e) all Mortgage Loans repurchased within
        twelve (12) months prior to the related Distribution Date and (f) any Mortgage
        Loan that has been modified during the preceding twelve-month
        period.

       

      “Accrued
        Certificate Interest”:
        Interest to be distributed to each Class of Certificates entitled to interest
        on
        any Distribution Date consisting of the sum of (i) interest accrued during
        the
        related Interest Accrual Period at the applicable Certificate Rate for such
        Class of Certificates on the Certificate Balance of such Class of Certificates
        immediately preceding such Distribution Date and (ii) accrued but unpaid
        Accrued
        Certificate Interest from prior Distribution Dates (on a cumulative basis,
        but
        without interest on such unpaid Accrued Certificate Interest) as reduced
        by such
        Class’s share of the amount of any reduction of interest collectible on any
        related Mortgage Loan as a result of the application of the Servicemembers
        Civil
        Relief Act, as amended, and any comparable state or local laws. 

       

      “Aggregate
        Subordinate Percentage”:
        At any
        time, the sum of the Class Principal Balances of the Subordinate Certificates
        divided by the sum of the outstanding principal balances for all the Mortgage
        Loans.

       

      “Assignment
        Agreements”: (i)
        the
        Assignment, Assumption and Recognition Agreement dated as of December 1,
        2007,
        by and among GSMC, the Depositor and Avelo, as servicer, (ii) the Assignment,
        Assumption and Recognition Agreement dated as of December 1, 2007, by and
        among
        the Depositor, Avelo and the Trustee, and as acknowledged by the Master
        Servicer, (iii) the Assignment, Assumption and Recognition Agreement dated
        as of
        December 1, 2007, by and among GSMC, the Depositor and Countrywide Servicing,
        as
        servicer, (iv) the Assignment, Assumption and Recognition Agreement dated
        as of
        December 1, 2007, by and among the Depositor, the Trustee and Countrywide
        Servicing, as servicer, and as acknowledged by the Master Servicer, (v) the
        Assignment, Assumption and Recognition Agreement dated as of December 1,
        2007,
        by and among GSMC, the Depositor and National City, as servicer, (vi) the
        Assignment, Assumption and Recognition Agreement dated as of December 1,
        2007,
        among the Depositor, the Trustee and National City, as servicer, and as
        acknowledged by the Master Servicer, (vii) the Assignment, Assumption and
        Recognition Agreement dated as of December 1, 2007, by and among GSMC, the
        Depositor and SunTrust, as servicer, (viii) the Assignment, Assumption and
        Recognition Agreement dated as of December 1, 2007, among the Depositor,
        the
        Trustee and SunTrust, as servicer, and as acknowledged by the Master Servicer,
        (ix) the Assignment, Assumption and Recognition Agreement dated as of December
        1, 2007, by and among GSMC, the Depositor and Wells Fargo, as servicer, and
        (x)
        the Assignment, Assumption and Recognition Agreement dated as of December
        1,
        2007, among the Depositor, the Trustee and Wells Fargo, as servicer, and
        as
        acknowledged by the Master Servicer.

       


      
        
          
          

        

        
          2

          
            

          

        

        
          
          

        

      


      “Available
        Distribution Amount”:
        For
        any Distribution Date, the sum of the following amounts:

       

      (i) the
        total
        amount of all cash received from or on behalf of the Mortgagors or advanced
        by
        the Servicer (or the Master Servicer in the event the Servicer fails to make
        such required advances, or by the Trustee in the event the Master Servicer
        fails
        to make any such required advances, in each case pursuant to Section 3.05
        of the
        Standard Terms) on the Mortgage Loans and not previously distributed (including
        Monthly Advances made by the Servicer (or by the Master Servicer in the event
        the Servicer fails to make such required advances, or by the Trustee in the
        event the Master Servicer fails to make any such required advances, in each
        case
        pursuant to Section 3.05 of the Standard Terms)), Compensating Interest Payments
        made by the Servicer (or the Master Servicer or other successor servicer,
        as the
        case may be) and proceeds of Mortgage Loans that are liquidated,
        except:

       

      (a) all
        Scheduled Payments collected but due on a Due Date after such Distribution
        Date;

       

      (b) all
        Curtailments received after the previous calendar month, unless the related
        Sale
        and Servicing Agreement specifies that such amounts shall be remitted by
        the
        related Remittance Date;

       

      (c) all
        Payoffs received after the previous calendar month (together with each interest
        payment received with such Payoffs to the extent that it represents the payment
        of interest accrued on the Mortgage Loans for the period after the previous
        calendar month), unless the related Sale and Servicing Agreement specifies
        that
        such amounts shall be remitted by the related Remittance Date;

       

      (d) Liquidation
        Proceeds, Condemnation Proceeds and Insurance Proceeds received on the Mortgage
        Loans after the previous calendar month;

       


      
        
          
          

        

        
          3

          
            

          

        

        
          
          

        

      


      (e) all
        amounts in the Certificate Account from Mortgage Loans that are then due
        and
        payable to the Servicer under the related Sale and Servicing
        Agreement;

       

      (f) the
        Servicing Fee and the Master Servicing Fee for each Mortgage Loan, net of
        any
        amounts payable as compensating interest by the applicable Servicer on that
        Distribution Date;

       

      (g) any
        amounts payable in respect of any primary mortgage insurance
        policy;

       

      (h) all
        related indemnification amounts and other related amounts reimbursable on
        such
        Distribution Date to the Securities Administrator, the Trustee, each Custodian
        or the Master Servicer; and

       

      (i) all
        expenses of the Trust Estate paid after the immediately preceding Distribution
        Date; 

       

      (ii) the
        total
        amount of any cash received by the Securities Administrator or the applicable
        Servicer (or the Master Servicer) from the repurchase by the applicable Loan
        Seller of any Mortgage Loans as a result of defective documentation or breach
        of
        representations and warranties; provided that the obligation to repurchase
        arose
        before the related Due Date and; provided further that the Available
        Distribution Amount for REMIC II shall be the amounts distributed by REMIC
        I.

       

      “Avelo”:
        Avelo
        Mortgage, L.L.C.

       

      “Bank
        of America”:
        Bank
        of America, National Association.

       

      “Book-Entry
        Certificates”:
        The
        Senior Certificates and the Subordinate Certificates.

       

      “Certificate
        Account Property”:
        The
        Certificate Account, all amounts, investments and other property held from
        time
        to time in the Certificate Account, and all proceeds of the
        foregoing.

       

      “Certificate
        Balance”:
        As to
        any Class of Certificates or Interests as of the close of business on each
        Distribution Date, the initial Certificate Balance thereof (as shown on the
        charts in Section 2.03) (a) reduced by (i) all principal payments previously
        distributed to such Class and (ii) all Realized Losses previously allocated
        to
        such Class and (b) increased, in the case of any Class of Certificates with
        respect to which the Certificate Balance thereof has been reduced by any
        Realized Loss, by the amount of any Subsequent Recoveries allocated to such
        Class in accordance with Section 3.02(e).

       

      “Certificate
        Rate”:
        With
        respect to each Class of Certificates on any Distribution Date, the percentage
        per annum or other entitlement to interest described in Section 2.03. With
        respect to each REMIC Interest on any Distribution Date, the Certificate
        Rates
        described in Section 2.03.

       


      
        
          
          

        

        
          4

          
            

          

        

        
          
          

        

      


      “Certificates”:
        The
        Class A-1, Class A-2, Class M-1, Class B-1, Class B-2, Class B-3, Class B-4,
        Class B-5, Class B-6, Class RC and Class R Certificates.

       

      “Class”:
        Each
        Class of Certificates or REMIC Interests. 

       

      “Class
        A Certificates”:
        The
        Class A-1 and Class A-2 Certificates. 

       

      “Class
        B Certificates”:
        The
        Class B-1, Class B-2, Class B-3, Class B-4, Class B-5 and Class B-6
        Certificates.

       

      “Class
        M Certificates”:
        The
        Class M-1 Certificates. 

       

      “Class
        Principal Balance”:
        As to
        any Class of Certificates on each Distribution Date, the total Certificate
        Balance of all Certificates of such Class on that Distribution
        Date.

       

      “Closing
        Date”:
        December 28, 2007.

       

      “Conduit
        Program”:
        GSMC’s
        mortgage conduit program, through which mortgage loans are acquired from
        time to
        time from various banks, savings and loan associations, mortgage bankers
        and
        other mortgage loan originators and purchasers of mortgage loans in the
        secondary market.

       

      “Corresponding
        Class”:
        For
        each Class of REMIC Interests or Certificates, the Class or Classes indicated
        as
        such in the tables set forth in Section 2.03.

       

      “Countrywide”:
        Countrywide Home Loans, Inc., or any successor in interest.

       

      “Countrywide
        Servicing”:
        Countrywide Home Loans Servicing LP, or any successor in interest.

       

      “Credit
        Support Depletion Date”:
        The
        first Distribution Date (if any) on which the aggregate Certificate Balance
        of
        the Subordinate Certificates has been or shall be reduced to zero.

       

      “Current
        Shortfall”:
        Any
        amount included in the Principal Distribution Amount for which cash is not
        available to make distributions as a result of the Servicer’s decision not to
        Advance a delinquent payment, other than a Realized Loss.

       

      “Custodian”:
        As
        defined in the Preliminary Statement.

       

      “Custodial
        Agreement”:
        The
        Master Custodial Agreement, dated as of December 1, 2007 among GSMC, the
        Custodians, the Servicers, the Master Servicer and the Securities Administrator.
        

      


      “Cut-Off
        Date”:
        December 1, 2007.

       

      “Data
        Collection Schedule”:
        As
        defined in the Custodial Agreement.

       


      
        
          
          

        

        
          5

          
            

          

        

        
          
          

        

      


      “Depositor”:
        GS
        Mortgage Securities Corp., in its capacity as depositor under this Trust
        Agreement.

       

      “Deutsche
        Bank”:
        Deutsche Bank National Trust Company, or any successor in interest.

       

      “Distribution
        Date”:
        The
        25th day of each month, or if such day is not a Business Day, the next Business
        Day following such day. The first Distribution Date shall be January 25,
        2008.

       

      “Due
        Date”:
        For
        any Mortgage Loan, the first day in each calendar month.

       

      “Due
        Period”:
        For
        any Distribution Date, the period beginning on the second day of the month
        immediately preceding the month in which such Distribution Date occurs and
        ending on the first day of the month in which such Distribution Date
        occurs.

       

      “Fair
        Market Value Excess”:
        An
        amount equal to the excess, if any, of the amount in clause (y) of the
        definition of “Termination Price,” over the amount in clause (x) of the
        definition of “Termination Price.”

       

      “Fitch”:
        Fitch
        Ratings, or any successor in interest.

       

      “GSMC”:
        Goldman Sachs Mortgage Company, or any successor in interest.

       

      “Interest
        Accrual Period”:
        For
        any Distribution Date (other than the first Distribution Date) and any regular
        interest in any REMIC created hereby or any Class of Certificates entitled
        to
        interest, the calendar month immediately preceding the calendar month in
        which
        such Distribution Date occurs (assuming a 30-day month). For the first
        Distribution Date and any regular interest in any REMIC created hereby or
        any
        Class of Certificates entitled to interest, interest will accrue from December
        1, 2007.

       

      “Interests”:
        Each
        Class of REMIC Interests.

       

      “Junior
        Subordinate Certificates”:
        The
        Class B-4, Class B-5 and Class B-6 Certificates.

       

      “Liquidation
        Principal”:
        For
        any Distribution Date, the principal portion of Liquidation Proceeds received
        from each Mortgage Loan that became a Liquidated Mortgage Loan during the
        calendar month preceding the month of such Distribution Date.

       

      “Loan
        Seller”:
        Each
        of National City, SunTrust, WaMu and Wells Fargo.

       

      “Master
        Servicer”:
        Wells
        Fargo Bank, N.A., in its capacity as Master Servicer, or any successor master
        servicer.

       

      “Master
        Servicing Fee”:
        With
        respect to any Distribution Date, all income and gain realized from the
        investment of funds in the Master Servicer Account during the Master Servicer
        Float Period relating to such Distribution Date, or with respect to a successor
        master servicer, the compensation agreed upon by the Trustee and such successor
        master servicer in accordance with the terms of this Trust Agreement.


       


      
        
          
          

        

        
          6

          
            

          

        

        
          
          

        

      


      “Moody’s”:
        Moody’s Investors Service, Inc., or any successor in interest.

       

      “Mortgage
        Loans”:
        The
        mortgage loans identified on Schedule I hereto.

       

      “National
        City”:
        National City Mortgage Co., or any successor in interest.

       

      “Net
        Rate”:
        With
        respect to each Mortgage Loan, the Note Rate of such Mortgage Loan reduced
        by
        the Servicing Fee Rate and the rate on any lender paid primary mortgage
        insurance for such Mortgage Loan. 

       

      “Net
        WAC”:
        As of
        any Distribution Date will equal the weighted average of the Net Rates of
        the
        Mortgage Loans as of the Due Date of the calendar month immediately preceding
        the calendar month of such Distribution Date, weighted on the basis of their
        principal balances and excluding any principal balance that was prepaid after
        such Due Date and distributed in such immediately preceding calendar
        month.

       

      “Note
        Rate”:
        For
        each Mortgage Loan, the rate at which the related promissory note accrues
        interest. For purposes of calculating the Certificate Rates on the Interests
        and
        Certificates, the Note Rate of a Mortgage Loan shall be calculated without
        regard to any modification, waiver or amendment of the interest rate of the
        Mortgage Loan, whether agreed to by the Servicer or resulting from a bankruptcy,
        insolvency or similar proceeding involving the related Mortgagor.

       

      “P&I
        Certificates”:
        All
        Classes of Certificates
        other
        than the Residual
        Certificates.

       

      “Prepayment
        Period”:
        With
        respect to each Distribution Date and each Mortgage Loan serviced by Countrywide
        Servicing, National City and SunTrust, the calendar month preceding the month
        in
        which such Distribution Date occurs. With respect to each Distribution Date
        and each Mortgage Loan serviced by Wells Fargo, a.) the period
        commencing on the 14th day of the month preceding the month in which such
        Distribution Date occurs and ending on the 13th day of the month in which
        such
        Distribution Date occurs or b.) the calendar month preceding the month in
        which
        such Distribution Date occurs, as specified in Exhibit 1 to the related
        Assignment Agreement. With respect to each Distribution Date and each
        Mortgage Loan serviced by Avelo, the period commencing on the 16th day of
        the
        month preceding the month in which such Distribution Date occurs and ending
        on
        the 15th day of the month in which such Distribution Date occurs. In the
        case of
        the first Distribution Date, the Prepayment Period commences on the Cut-Off
        Date.

       

      “Principal
        Distribution Amount”:
        For
        any Distribution Date, the sum of:

       

      (1) the
        Principal Payment Amount;

       

      (2) the
        Principal Prepayment Amount; and

       

      (3) the
        Liquidation Principal derived from such Mortgage Loan.

       

      “Principal
        Payment Amount”:
        For
        any Distribution Date and each Mortgage Loan, the sum of the following
        amounts:

       


      
        
          
          

        

        
          7

          
            

          

        

        
          
          

        

      


      (a) the
        principal portion of Scheduled Payments on such Mortgage Loan due on the
        related
        Due Date and received or advanced during the related Due Period;

       

      (b) the
        principal portion of repurchase proceeds received on such Mortgage Loan for
        which an obligation or opportunity to repurchase such Mortgage Loan as permitted
        or required by this Trust Agreement arose during or before the related Due
        Period during the calendar month preceding the month of such Distribution
        Date;
        and

       

      (c) any
        other
        unscheduled payments of principal which were received on such Mortgage Loan
        during the period beginning on and including the second day of the preceding
        calendar month and ending on and including the first day of the current calendar
        month, other than Payoffs, Curtailments, or Liquidation Principal.

       

      “Principal
        Prepayment Amount”:
        For
        any Distribution Date and each Mortgage Loan, the sum of all Payoffs and
        Curtailments for such Mortgage Loan that were received during the related
        Prepayment Period (as
        specified in the related Sale and Servicing Agreement).

       

      “Private
        Certificates”:
        The
        Junior Subordinate Certificates.

       

      “Qualified
        Institutional Buyer”:
        Any
“qualified institutional buyer” as defined in clause 7(a) of Rule 144A
        promulgated under the Securities Act.

       

      “Rating
        Agency”:
        Each
        of Fitch and S&P.

       

      “Record
        Date”:
        For
        each Class of Certificates, the last Business Day of the related Interest
        Accrual Period.

       

      “REMIC”:
        As
        specified in the preliminary statement.

       

      “REMIC
        I”:
        One of
        the real estate mortgage investment conduits created hereunder, which consists
        of the Mortgage Loans and the REMIC I Distribution Account.

       

      “REMIC
        I Regular Interests”:
        The
        regular interests issued by REMIC I as specified in Section 2.03.

       

      “REMIC
        II”:
        One of
        the real estate mortgage investment conduits created hereunder, which consists
        of the REMIC II Distribution Account.

       

      “REMIC
        II Regular Interests”:
        The
        regular interests issued by REMIC II as specified in Section 2.03.

       

      “REMIC
        Class”
or
        “REMIC
        Certificate”:
        Each
        Class of Certificates or Certificate, as applicable, issued by REMIC II pursuant
        to Section 2.03 and the Class RC and Class R Certificates.

       

      “REMIC
        Interests”:
        Each
        Class of REMIC interests issued pursuant to Section 2.03.

       


      
        
          
          

        

        
          8

          
            

          

        

        
          
          

        

      


      “Remittance
        Date”:
        For
        each Mortgage Loan and any Distribution Date, as set forth in the related
        Sale
        and Servicing Agreement. 

       

      “Residual
        Certificates”:
        The
        Class RC and Class R Certificates.

       

      “Rule
        144A Certificates”:
        The
        Junior Subordinate Certificates.

       

      “S&P”:
        Standard & Poor’s Ratings Services, a division of The McGraw-Hill Companies,
        Inc.

       

      “Sale
        and Servicing Agreement”:
        each
        of the (i) Flow Servicing Agreement dated as of January 1, 2006, by
        and
        between GSMC and Avelo, as servicer, (ii)
        Transfer and Purchase Agreement dated as of December 28, 2004, among Wells
        Fargo, as successor in interest to Ryland Mortgage Company as master servicer,
        Countrywide Home Loans, Inc. and GSMC, (iii) Confirmation Agreement dated
        as of
        March 1, 2005 between Countrywide Servicing and GSMC, (iv) Servicing Agreement
        dated as of July 1, 2004, between GSMC, as owner, and Countrywide Servicing,
        as
        servicer, as amended by Amendment Reg AB, dated as of January 1, 2006 by
        and
        between GSMC and Countrywide Home Loans, Inc.; (v) Third Amended and Restated
        Flow Seller’s Warranties and Servicing Agreement dated as of September 1, 2007,
        between GSMC and National City (vi) Amended and Restated Flow Seller’s
        Warranties and Servicing Agreement, dated as of December 1, 2005, as amended
        by
        Amendment No. 1, dated as of July 1, 2006 between GSMC and SunTrust; (vii)
        Amended and Restated Master Seller’s Warranties and Servicing Agreement, dated
        as of December 1, 2005, between Bank of America and Wells Fargo; (viii) Amended
        and Restated Master Mortgage Loan Purchase Agreement, dated as of December
        1,
        2005, between Bank of America and Wells Fargo; (ix) Assignment and Conveyance
        Agreement dated December 15, 2005, between Bank of America and Wells Fargo;
        (x)
        Second Amended and Restated Master Seller’s Warranties and Servicing Agreement
        dated as of May 1, 2006, between Bank of America and Wells Fargo; (xi)
        Assignment and Conveyance Agreement dated May 24, 2006, between Bank of America
        and Wells Fargo; (xii) Assignment and Conveyance Agreement dated July 25,
        2006,
        between Bank of America and Wells Fargo; (xiii) Mortgage Loan Purchase Agreement
        dated as of July 1, 2006, between Bank of America and DLJ Mortgage Capital,
        Inc.; (xiv) Assignment Assumption and Recognition Agreement dates as of February
        26, 2007, among Bank of America, Wells Fargo and GSMC; (xv) Assignment
        Assumption and Recognition Agreement dates as of February 26, 2007, among
        Bank
        of America, DLJ Mortgage Capital, Inc., Wells Fargo and GSMC; and (xvi) Second
        Amended and Restated Master Seller’s Warranties and Servicing Agreement, dated
        as of November 1, 2005, between GSMC and Wells Fargo. 

       

      “Scheduled
        Final Distribution Date”:
        For
        each Class of Certificates, the respective dates specified in Section
        2.03(e).

       

      “Scheduled
        Payments”:
        With
        respect to any Mortgage Loan, the monthly payments of principal and interest
        payable by the related Mortgagor pursuant to the related amortization
        schedule.

       


      
        
          
          

        

        
          9

          
            

          

        

        
          
          

        

      


      “Scheduled
        Principal Amount”:
        With
        respect to any Distribution Date, an amount equal to the amount described
        in
        clause (i) of the definition of Senior Principal Distribution
        Amount.

       

      “Securities
        Administrator”:
        Wells
        Fargo Bank, N.A. in its capacity as Securities Administrator under this Trust
        Agreement, or any successor securities administrator.

       

      “Senior
        Certificates”:
        The
        Class A Certificates.

       

      “Senior
        Interests”:
        All of
        the REMIC M-T Regular Interests except those corresponding to a Class B
        Certificate.

       

      “Senior
        Liquidation Amount”:
        For
        any Distribution Date and each Mortgage Loan that became a Liquidated Mortgage
        Loan during the calendar month preceding the month of such Distribution Date,
        the lesser of (i) the related Senior Percentage of the Scheduled Principal
        Balance of such Mortgage Loan and (ii) the Senior Prepayment Percentage of
        the
        Liquidation Principal derived from such Mortgage Loan.

       

      “Senior
        Percentage”:
        For
        (i) the Closing Date, will equal 96.10% and (ii) for any Distribution Date
        thereafter will be a fraction expressed as a percentage, the numerator of
        which
        is (a) the sum of the Certificate Balances of the Senior Certificates
        immediately preceding such Distribution Date and the denominator of which
        is (b)
        the sum of the total outstanding principal balance of the Mortgage Loans
        immediately preceding such Distribution Date.

       

      “Senior Prepayment Percentage”:
        For (i)
        any Distribution Date occurring before the Distribution Date in January 2013,
        100%; (ii) on any other Distribution Date on which the Senior Percentage
        for
        such Distribution Date exceeds the initial Senior Percentage as of the Cut-Off
        Date, 100%; and (iii) on any other Distribution Date in the month of January
        2013 and thereafter, 100%, unless:

       

      (a) the
        outstanding aggregate Scheduled Principal Balances of 60+ Day Delinquent
        Mortgage Loans (averaged over the preceding six-month period), as a percentage
        of the aggregate Class Principal Balance of the Subordinate Certificates
        immediately prior to that Distribution Date, does not equal or exceed 50%,
        and

       

      (b) the
        cumulative Realized Losses on the Mortgage Loans, commencing with the following
        Distribution Dates do not exceed the following percentages of the aggregate
        Class Principal Balance of the Subordinate Certificates as of the Closing
        Date
        (“Original
        Subordinate Principal Balance”):

       

      
        	
                Distribution
                  Dates

              	
                Percentage
                  of the Original Subordinate

                Principal
                  Balance

              
	
                Distribution
                  Date on the fifth anniversary of the first Distribution
                  Date

              	
                30%

              
	
                Distribution
                  Date on the sixth anniversary of the first Distribution
                  Date

              	
                35%

              
	
                Distribution
                  Date on the seventh anniversary of the first Distribution
                  Date

              	
                40%

              
	
                Distribution
                  Date on the eighth anniversary of the first Distribution
                  Date

              	
                45%

              
	
                Distribution
                  Date on the ninth anniversary of the first Distribution
                  Date

              	
                50%

              


      

      


      
        
          
          

        

        
          10

          
            

          

        

        
          
          

        

      

       

      in
        which
        case, the Senior Prepayment Percentage for will be calculated as
        follows:

       

      •  for
        any
        Distribution Date occurring in January 2013 through December 2013, the Senior
        Percentage for that Distribution Date plus 70% of the Subordinate Percentage
        for
        that Distribution Date;

       

      •  for
        any
        Distribution Date occurring in January 2014 through December 2014, the Senior
        Percentage for that Distribution Date plus 60% of the Subordinate Percentage
        for
        that Distribution Date;

       

      •  for
        any
        Distribution Date occurring January 2015 through December 2015, the Senior
        Percentage for that Distribution Date plus 40% of the Subordinate Percentage
        for
        that Distribution Date;

       

      •  for
        any
        Distribution Date occurring in January 2016 through December 2016, the Senior
        Percentage for that Distribution Date plus 20% of the Subordinate Percentage
        for
        that Distribution Date; 

       

      •  for
        any
        Distribution Date occurring in or after January 2017 (other than the final
        Distribution Date), the Senior Prepayment Percentage will equal the Senior
        Percentage for that Distribution Date; and

       

      •  for
        the
        final Distribution Date, the Senior Prepayment Percentage will equal
        100%.

       

      If
        on any
        Distribution Date the allocation to the P&I Certificates of Principal
        Prepayments in the percentage required would reduce the sum of the Certificate
        Balances of the P&I Certificates below zero, the Senior Prepayment
        Percentage for such Distribution Date shall be equal to the percentage necessary
        to reduce such sum to zero.

       


      
        
          
          

        

        
          11

          
            

          

        

        
          
          

        

      


      “Senior
        Principal Distribution Amount”:
        For
        any Distribution Date shall equal the sum of:

       

      
        	 	
                (i)

              	
                the
                  Senior Percentage of the Principal Payment Amount for such Distribution
                  Date;

              


      

       

      
        	 	
                (ii)

              	
                the
                  Senior Prepayment Percentage of the Principal Prepayment Amount
                  for such
                  Distribution Date; and

              


      

       

      
        	 	
                (iii)

              	
                the
                  Senior Liquidation Amount for such Distribution
                  Date.

              


      

       

      “Senior
        Subordinate Certificates”:
        The
        Class M-1, Class B-1, Class B-2 and Class B-3 Certificates.

       

      “Servicer”:
        Each
        of Avelo, Countrywide Servicing, National City, SunTrust and Wells Fargo
        and
        their respective successors or assigns, in their respective capacities as
        servicer under the related Sale and Servicing Agreement.

       

      “Servicing
        Fee Rate”:
        For
        each Mortgage Loan, the per annum fee described in Schedule I
        hereto.

       

      “Subordinate
        Certificates”:
        The
        Class M and Class B Certificates.

       

      “Subordinate
        Class Percentage”:
        For
        each Class of Subordinate Certificates and each Distribution Date, the
        percentage obtained by dividing the Class Principal Balance of such Class
        immediately prior to such Distribution Date by the aggregate Certificate
        Principal Balance of all related Subordinate Certificates immediately prior
        to
        such date.

       

      “Subordinate
        Interests”:
        The
        Interest corresponding to the Subordinate Certificates.

       

      “Subordinate
        Liquidation Amount”:
        For any
        Distribution Date, the Liquidation Principal in respect of each Mortgage
        Loan
        that became a Liquidated
        Mortgage Loan
        during
        the calendar month preceding the month of such Distribution Date, minus the
        Senior
        Liquidation Amount for
        such
        Distribution Date.

       

      “Subordinate
        Percentage”:
        For
        any Distribution Date, the excess of 100% over the Senior Percentage. The
        Subordinate Percentage as of the Closing Date shall be 3.90%.

       

      “Subordinate
        Prepayment Percentage”:
        For
        any Distribution Date, the excess of 100% over the Senior Prepayment Percentage.
        Initially, the Subordinate Prepayment Percentage shall be 0%.

       

      “Subordinate
        Principal Distribution Amount”:
        For
        any Distribution Date, the sum of:

       


      
        
          
          

        

        
          12

          
            

          

        

        
          
          

        

      


      
        	 	
                (i)

              	
                the
                  Subordinate Percentage of the Principal Payment
                  Amount;

              


      

       

      
        	 	
                (ii)

              	
                the
                  Subordinate Principal Prepayment Amount;
                  and

              


      

       

      
        	 	
                (iii)

              	
                the
                  Subordinate Liquidation Amount;

              


      

       

      “Subordinate
        Principal Prepayment Amount”:
        For
        each Distribution Date, the Subordinate Prepayment Percentage of the Principal
        Prepayment Amount.

       

      “Subordination
        Levels”:
        For
        any Class of Subordinate Certificates and any specified date, the percentage
        obtained by dividing (i) the sum of the Class Principal Balances of all Classes
        of Subordinate Certificates that are subordinate to such Class by (ii) the
        sum
        of the Class Principal Balances of all Classes of Certificates as of such
        date,
        before giving effect to distributions and allocations of Realized Losses
        on such
        date.

       

      “Subsequent
        Recovery”:
        With
        respect to any Liquidated Mortgage Loan on which a Realized Loss has occurred,
        any amount that the related Servicer ultimately recovers in respect of such
        Liquidated Mortgage Loan, net of the reasonable fees of the Servicer associated
        with such recovery.

       

      “SunTrust”:
        SunTrust Mortgage, Inc., or any successors in interest.

       

      “Trust
        Estate”:
        As
        defined in Section 2.01 hereof.

       

      “Trust
        Agreement”:
        This
        Master Servicing and Trust Agreement, dated as of December 1, 2007, which
        incorporates by reference the Standard Terms to Master Servicing and Trust
        Agreement (December 2007 edition); provided
        that any
        references in any documents required to be provided pursuant to the terms
        of
        this Trust Agreement, including references in documents within the Trustee
        Mortgage Loan File, to a Trust Agreement dated as of December 1, 2007, shall
        be
        deemed to refer to this Trust Agreement.

       

      “Trustee”:
        U.S.
        Bank National Association, not in its individual capacity but solely as Trustee
        under this Trust Agreement, or its successor in interest, or any successor
        trustee appointed as herein provided.

       

      “UCC”:
        The
        Uniform Commercial Code as in effect in the State of New York.

       

      “Unscheduled
        Principal Amount”:
        With
        respect to any Distribution Date, an amount equal to the sum of the amounts
        described in clauses (ii) and (iii) of the definition of Senior Principal
        Distribution Amount.

       

      “Verified
        Information”:
        As
        defined in the Custodial Agreement.

       

      “Wells
        Fargo”:
        Wells
        Fargo Bank, N.A., or any successors in interest.

       

       

       


      
        
          
          

        

        
          13

          
            

          

        

        
          
          

        

      


       

      ARTICLE
        II.

       

      FORMATION
        OF TRUST; CONVEYANCE OF MORTGAGE LOANS

       

      Section
        2.01. Conveyance
        to the Trustee.

       

      (a) To
        provide for the distribution of the principal of and interest on the
        Certificates and Interests in accordance with their terms, all of the sums
        distributable under this Trust Agreement with respect to the Certificates
        and
        the Interests and the performance of the covenants contained in this Trust
        Agreement, the Depositor hereby bargains, sells, conveys, assigns and transfers
        to the Trustee, in trust, without recourse and for the exclusive benefit
        of the
        Holders of the Certificates, all of the Depositor’s right, title and interest in
        and to any and all benefits accruing to the Depositor from: (i) the Mortgage
        Loans, the related Trustee Mortgage Loan Files, and all Monthly Payments
        due
        thereon after the Cut-Off Date and all principal prepayments collected with
        respect to the Mortgage Loans and paid by a Borrower on or after the Cut-Off
        Date, and proceeds of the conversion, voluntary or involuntary, of the
        foregoing; (ii) the Sale and Servicing Agreements; provided
        that the
        Depositor hereby reserves its right to indemnification under the Sale and
        Servicing Agreements; (iii) the Custodial Agreement; (iv) the Assignment
        Agreements; (v) the Distribution Account, the Master Servicer Account, the
        Certificate Account and the Collection Accounts and (vi) proceeds of all
        of the
        foregoing (including, without limitation, all amounts, other than investment
        earnings, from time to time held or invested in the Collection Account and
        the
        Certificate Account, whether in the form of cash, instruments, securities
        or
        other property, all proceeds of any mortgage insurance, mortgage guarantees,
        hazard insurance, or title insurance policy relating to the Mortgage Loans,
        cash
        proceeds, accounts, accounts receivable, notes, drafts, acceptances, chattel
        paper, checks, deposit accounts, rights to payment of any and every kind,
        and
        other forms of obligations and receivables, which at any time constitute
        all or
        part or are included in the proceeds of any of the foregoing) to pay the
        REMIC
        Interests and the Certificates as specified herein (collectively items (i)
        through (vi), the “Trust Estate”). 

       

      (b) It
        is
        intended that the conveyance of the Trust Estate by the Depositor to the
        Trustee
        as provided in this Section be, and be construed as, a sale of the Trust
        Estate
        by the Depositor to the Trustee for the benefit of the Certificateholders.
        It
        is, further, not intended that such conveyance be deemed a pledge of the
        Trust
        Estate by the Depositor to the Trustee to secure a debt or other obligation
        of
        the Depositor. However, in the event that the Trust Estate is held to be
        the
        property of the Depositor, or if for any reason this Agreement is held or
        deemed
        to create a security interest in the Trust Estate, then it is intended that
        this
        Agreement shall also be deemed to be a security agreement within the meaning
        of
        Articles 8 and 9 of the UCC and the corresponding articles of the Uniform
        Commercial Code of any other applicable jurisdiction; and the Depositor hereby
        grants to the Trustee for the benefit of the Certificateholders a security
        interest in all of the Depositor’s right, title and interest, whether now owned
        or existing or hereafter acquired or arising, in and to the Trust Estate.
        The
        Depositor and the Trustee, at the Depositor’s direction and expense, shall, to
        the extent consistent with this Agreement, take such actions as may be necessary
        to ensure that, if this Agreement were deemed to create a security interest
        in
        assets constituting the Trust Estate described above, such security interest
        would be deemed to be a perfected security interest of first priority under
        applicable law and will be maintained as such throughout the term of the
        Agreement.

       


      
        
          
          

        

        
          14

          
            

          

        

        
          
          

        

      


      (c) The
        foregoing sale, transfer, assignment, set-over and conveyance does not and
        is
        not intended to result in the creation of an assumption by the Trustee of
        any
        obligation of the Depositor, the Seller or any other person in connection
        with
        the Mortgage Loans, the Sale and Servicing Agreements, the Assignment Agreements
        or under any agreement or instrument relating thereto except as specifically
        set
        forth herein.

       

      (d) It
        is
        agreed and understood by the Depositor and the Trustee (and the Depositor
        so
        represents and recognizes) that it is not intended that any Mortgage Loan
        to be
        included in the Trust Estate be (i) a “High-Cost Home Loan” as defined in the
        New Jersey Home Ownership Act effective November 27, 2003, (ii) a “High-Cost
        Home Loan” as defined in the New Mexico Home Loan Protection Act effective
        January 1, 2004, (iii) a “High-Cost Home Mortgage Loan” as defined in the
        Massachusetts Predatory Home Loan Practices Act effective November 7, 2004
        or
        (iv) a “High Cost Home Loan” as defined in the Indiana Home Loan Practices Act
        effective February 1, 2005.

       

      Section
        2.02. Acceptance
        by the Trustee and Securities Administrator.

       

      By
        its
        execution of this Trust Agreement, the Trustee acknowledges and declares
        that it
        holds and shall hold or has agreed to hold (in each case through the applicable
        Custodian) all documents delivered to any such person from time to time with
        respect to the Mortgage Loans and all assets included in the definition of
        Trust
        Estate herein in trust for the exclusive use and benefit of all present and
        future Holders of the Certificates. The Trustee has not created and shall
        not
        create, and no Officer of the Trustee has any actual knowledge or has received
        actual notice of, any interest in the Trust Estate contrary to the interests
        created by this Trust Agreement. The Trustee has not entered, nor intends
        to
        enter, into any subordination agreement or intercreditor agreement with respect
        to any assets included in the Trust Estate.

       

      Pursuant
        to Section 2.02(f) of the Standard Terms, the Depositor acknowledges the
        appointment of each Custodian and agrees to deliver, or cause to be delivered,
        to the applicable Custodian all Mortgage Loan documents that are to be included
        in the Trustee Mortgage Loan File for each Mortgage Loan for which such
        Custodian shall act as custodian. The Depositor and each Custodian acknowledge
        that, pursuant to the Custodial Agreement and in connection with the formation
        of the Trust, the Depositor hereby assigns the Custodial Agreement to the
        Trustee and agrees to cause a receipt to be issued in the name of the Trustee.
        It is understood that each Custodian will charge for its services under this
        Agreement as set forth in a separate agreement between such Custodian and
        the
        Securities Administrator, the payment of which fees and expenses (as set
        forth
        in such separate agreement) shall be the sole obligation of the Securities
        Administrator. The Securities Administrator will further pay or reimburse
        such
        Custodian upon its request for all reasonable expenses, disbursements and
        advances incurred or made by such Custodian in accordance with this Agreement,
        the Custodial Agreement and any document executed in connection herewith
        or
        therewith.

       


      
        
          
          

        

        
          15

          
            

          

        

        
          
          

        

      


      Pursuant
        to a separate agreement, the Master Servicer shall pay the Trustee fee and
        the
        Securities Administrator fee from the Master Servicing Fee.

       

      Section
        2.03. REMIC
        Elections and REMIC Interests Designations.

       

      (a) REMIC
        Elections. Elections shall be made by the Securities Administrator to treat
        the
        assets of the Trust Estate described in the definition of the term “REMIC I” and
        the assets of the Trust Estate described in the definition of the term “REMIC
        II” as separate REMICs for federal income tax purposes. The REMIC I Regular
        Interests shall constitute the regular interests in REMIC I and the REMIC
        II
        Regular Interests shall constitute the regular interests in REMIC II. The
        Class
        RC Certificates shall represent ownership of the sole Class of residual interest
        in REMIC I. The Class R Certificates shall represent ownership of the sole
        Class
        of residual interests in REMIC II.

       

      (b) REMIC
        I
        Interests. REMIC I shall issue each of the following Classes of Interests
        in
        book-entry form, each of which shall be a Class of REMIC I Interests, having
        the
        following Certificate Rates and initial principal balances:

       

      
        	
                Class

              	
                Initial
                  Certificate Balance

              	
                Certificate
                  Rate

              
	 	 	 
	
                LT1-Pool

              	
                (1)

              	
                (2)

              
	
                RC

              	
                (3)

              	
                (3)

              
	 	 	 


      

       

      
        	 	
                (1)

              	
                This
                  Interest shall have an initial principal balance equal to the aggregate
                  principal balance of the Mortgage Loans as of the Cut-Off
                  Date.

              


      

       

      
        	 	
                (2)

              	
                This
                  Interest shall bear interest for any Interest Accrual Period equal
                  to (i)
                  the Net WAC over (ii) (x) the sum of any expenses payable to the
                  Securities Administrator or to the Trustee (to the extent such
                  expenses
                  were not taken into account in computing the Net Rate of any Mortgage
                  Loan
                  and do not constitute “unanticipated expenses” of a REMIC within the
                  meaning of Treasury Regulation Section 1.860G-1(b)(3)(ii)) divided
                  by (y)
                  the aggregate Scheduled Principal Balance of the Mortgage Loans
                  as of the
                  beginning of such Interest Accrual Period adjusted for prepayments
                  after
                  the beginning of such Interest Accrual Period that were distributed
                  on the
                  prior Distribution Date.

              


      

       

      
        	 	
                (3)

              	
                The
                  Class RC Certificate shall not be entitled to payments of principal
                  or
                  interest.

              


      

       

      (c) REMIC
        II.
        REMIC II shall issue the following Classes of Certificates (other than the
        Class
        RC and Class R Certificates), with the designations, initial Certificate
        Balances and Certificate Rates indicated, each of which (other than the Class
        RC
        and Class R Certificates) shall be a Class of REMIC II Regular
        Interests.

       


      
        
          
          

        

        
          16

          
            

          

        

        
          
          

        

      


      


      
        	
                Class

              	
                Initial
                  Certificate Balance

              	
                Certificate
                  Rate

              
	
                A-1

              	
                $
                  667,024,000 

              	
                (1)

              
	
                A-2(5)

              	
                $ 
                   28,215,000

              	
                (1)

              
	
                M-1

              	
                $ 
                   10,128,000

              	
                (1)

              
	
                B-1

              	
                $   
                   4,341,000

              	
                (1)

              
	
                B-2

              	
                $    
                  4,702,000

              	
                (1)

              
	
                B-3

              	
                $   
                   2,532,000

              	
                (1)

              
	
                B-4

              	
                $   
                   2,894,000

              	
                (1)

              
	
                B-5

              	
                $   
                   2,170,000

              	
                (1)

              
	
                B-6

              	
                $     1,447,809

              	
                (1)

              
	
                RC

              	
                (2)

              	
                (2)

              
	
                R

              	
                (2)

              	
                (2)

              


      

       

      
        	 	
                (1)

              	
                For
                  each Distribution Date (and the related Interest Accrual Period)
                  each of
                  the Class A-1, Class A-2, Class M-1, Class B-1, Class B-2, Class
                  B-3,
                  Class B-4, Class B-5 and Class B-6 Certificates shall accrue interest
                  at a
                  per annum rate equal to the Net
                  WAC.

              


      

       

      
        	 	
                (2)

              	
                The
                  Class R Certificate shall represent the sole Class of residual
                  interest in
                  REMIC II. 

              


      

       

      (d) REMIC
        Scheduled Final Distribution. The Scheduled Final Distribution Date for the
        Regular Interests in REMIC I and REMIC II is the Distribution Date following
        the
        third anniversary of the scheduled maturity date of the Mortgage Loan having
        the
        latest scheduled maturity as of the Closing Date.

       

      ARTICLE
        III.

       

      REMITTING
        TO CERTIFICATEHOLDERS

       

      Section
        3.01. Distributions
        to Certificateholders.

       

      (a) REMIC
        II
        Distributions. In accordance with Section 3.01(d) of the Standard Terms and
        subject to the exceptions set forth below and to Section 3.02, on each
        Distribution Date, the Securities Administrator shall withdraw the aggregate
        Available Distribution Amount from the Certificate Account, and shall distribute
        it in the following manner and order of priority:

       

      (i) to
        each
        Class of REMIC Certificates that are Senior Certificates, Accrued Certificate
        Interest thereon, pro
        rata in
        proportion to the amount of Accrued Certificate Interest owing to each such
        Class; 

       

      (ii) to
        the
        extent of the remaining Available Distribution Amount, to the Class A-1 and
        Class A-2 Certificates, in reduction of their respective Class Principal
        Balances, pro
        rata,
        in
        proportion to the Class Principal Balance of each such Class, in an amount
        up to
        the Senior Principal Distribution Amount for such Distribution Date, until
        the
        Class Principal Balance of each such Class is reduced to zero; 

       

      (iii) to
        the
        extent of the remaining Available Distribution Amount and subject to the
        prior
        distribution of amounts described under Section 3.01(e) below, to the Classes
        of
        Subordinate Certificates, in their order of seniority the sum of (i) Accrued
        Certificate Interest, pro
        rata, on
        the
        basis of the amount owing to each such Class, and (ii) their pro
        rata shares,
        based on their outstanding Certificate Balances, of the Subordinate Principal
        Distribution Amount, as applicable; provided,
        however,
        that on
        any Distribution Date on which the Subordination Level for any class of
        Subordinate Certificates is less than its Subordination Level as of the Closing
        Date, the portion of the Subordinate Principal Prepayment Amount otherwise
        allocable to the Class or Classes of Subordinate Certificates junior to such
        Class will be allocated pro
        rata
        to the
        most senior Class of Subordinate Certificates for which the Subordination
        Level
        on such Distribution Date is less than the Subordination Level as of the
        Closing
        Date and all Classes of Subordinate Certificates senior thereto; 

       


      
        
          
          

        

        
          17

          
            

          

        

        
          
          

        

      


      (iv) to
        each
        Class of Certificates, in the order of their seniority, the amount of any
        unreimbursed Realized Losses previously allocated to such Certificates;
        and

       

      (v) after
        all
        of the other Classes of Certificates (other than the Residual Certificates)
        have
        been paid in full, the remainder, if any, which is expected to be zero, of
        the
        Available Distribution Amount (other than any Fair Market Value Excess remaining
        after an optional termination of the Trust Estate) to the Class RC Certificates
        to the extent such remainder is applicable to REMIC I and otherwise to the
        Class
        R Certificates. 

       

      On
        each
        Distribution Date on or after the Credit Support Depletion Date, to the extent
        of the Available Distribution Amount on such Distribution Date, distributions
        shall be made to the Senior Certificates, in respect of interest (pro
        rata
        according to Accrued Certificate Interest for such Distribution Date) and
        then
        with respect to principal (pro
        rata
        according to their respective outstanding Class Principal Balances); and
        the
        remainder (other than any Fair Market Value Excess remaining after the optional
        termination of the Trust Estate), if any, which is expected to be zero, of
        the
        Available Distribution Amount shall be distributed to the holders of the
        Class
        RC Certificates to the extent such remainder is applicable to REMIC I and
        otherwise to the holder of the Class R Certificates.

       

      On
        each
        Distribution Date on which the aggregate Certificate Principal Balance of the
        Senior Certificates has been reduced to zero, any amounts distributable pursuant
        to this Section 3.01(a) shall be allocated, as to each applicable Class of
        Subordinate Certificates, in proportion to such Class’s Subordinate Class
        Percentage of the Subordinate Principal Distribution Amount.

       

      On
        each
        Distribution Date on which the Senior Certificates remain outstanding, any
        amounts distributable pursuant to this Section 3.01(a) shall be distributed
        in
        proportion to the aggregate Certificate Principal Balances of such
        Certificates.

       

      (b) [Reserved].

       

      (c) REMIC
        I
        Distributions. On each Distribution Date, the Securities Administrator shall
        apply amounts in the REMIC I Distribution Account in respect of interest
        to the
        Class LT1 Pool Interest in accordance with its interest rate set forth above.
        In
        addition, on each Distribution Date, the Securities Administrator shall apply
        amounts in the REMIC I Distribution Account in respect of principal to the
        Class
        LT1-Pool Interest until its principal balance is reduced to zero. 

       


      
        
          
          

        

        
          18

          
            

          

        

        
          
          

        

      


      Realized
        Losses and Shortfalls shall be allocated in the same manner.

       

      The
        Securities Administrator shall withdraw all amounts allocated to the REMIC
        I
        Regular Interests and deposit such amounts in the Certificate Account for
        distribution pursuant to Section 3.01(a) above on such Distribution Date.
        Any
        amount remaining in the REMIC I Distribution Account after making all other
        payments required under this Section 3.01(d) shall be distributed to the
        holder
        of the Class RC Certificates.

       

      (d) [Reserved].

       

      (e) On
        each
        Distribution Date on which any Fair Market Value Excess is on deposit in
        the
        Certificate Account and such Fair Market Value Excess has not been previously
        distributed in accordance with this Section 3.01(h), the Securities
        Administrator shall withdraw such Fair Market Value Excess, from the Certificate
        Account, and shall distribute it to the Holder of the Class RC
        Certificates.

       

      Section
        3.02. Allocation
        of Realized Losses and Shortfalls.

       

      (a) Realized
        Losses of Principal.

       

      (i) On
        each
        Distribution Date, a Realized Loss on a Mortgage Loan, to the extent allocable
        to principal, shall be allocated to the Class or Classes of REMIC Interests
        in
        reduction of the Certificate Balance thereof; provided,
        however,
        that
        any Realized Loss shall be allocated first to the Subordinate Interests,
        in
        reverse numerical order, until the Certificate Balances thereof are reduced
        to
        zero, and then to the Senior Interests; provided,
        further,
        that
        any remaining Realized Losses shall be allocated first to the Class A-2
        Certificates, until the Class Principal Balance of the Class A-2 Certificates
        is
        reduced to zero and second to the Class A-1 Certificates, until the Class
        Principal Balance of the Class A-1 Certificates is reduced to zero.

       

      (ii) [Reserved].

       

      (b) Realized
        Losses Allocable to Interest. On each Distribution Date, the portion of each
        Realized Loss on a Mortgage Loan that exceeds the outstanding principal amount
        of such Mortgage Loan shall be allocated pro
        rata
        on the
        basis of the amount of interest from such Mortgage Loan, to each Class of
        related REMIC Interest. On each Distribution Date, the interest portion of
        each
        Realized Loss allocated in accordance with the preceding sentence shall be
        further allocated pro
        rata,
        on the
        basis of Accrued Certificate Interest on the Class Principal Balance thereof,
        to
        each
        Class of related REMIC Interests;
        provided that the interest portion of any Realized Losses allocated to the
        related Subordinate Interests in a REMIC as provided in this Section 3.02(b)
        shall be allocated to such Subordinate Interests in reverse order of
        seniority.

       

      (c) Interest
        Shortfall. Notwithstanding anything in the Standard Terms to the contrary,
        on
        each Distribution Date, before any distributions are made on the REMIC Interests
        and the Certificates, Month End Interest Shortfall not covered by a Compensating
        Interest Payment and Servicemembers Shortfall with respect to any Mortgage
        Loan
        shall be allocated pro
        rata
        among
        the Classes of the related REMIC based on the amount of interest otherwise
        owing
        thereto in reduction of that amount.

       


      
        
          
          

        

        
          19

          
            

          

        

        
          
          

        

      


      (d) Modification
        Losses. In the event that the Note Rate on a Mortgage Loan is reduced as
        a
        result of a modification of the terms of such Mortgage Loan, such modification
        shall be disregarded for purposes of calculating the Certificate Rate on
        any
        Class of Certificates or Class of REMIC Interest. Any shortfall resulting
        from
        any such modifications, however, shall be treated as a Realized Loss occurring
        on each Distribution Date and shall be applied to reduce the Certificate
        Balances of the Certificates and REMIC Interests in the manner and order
        of
        priority set forth above.

       

      (e) In
        the
        event of any Subsequent Recovery, (i) such amount shall be treated as a
        Principal Prepayment Amount and shall be included in the related Available
        Distribution Amount for the Distribution Date occurring in the month following
        the month in which such recovery is received and (ii) the Certificate Balance
        of
        the Class or Classes to which the related Realized Loss had previously been
        allocated, whether or not such Class or Classes remain outstanding, shall
        be
        increased in direct order of priority, in each case by an amount equal to
        the
        lesser of (x) the amount of such recovery and (y) the aggregate amount of
        Realized Losses previously allocated to such Classes less amounts previously
        allocated to such Classes pursuant to this paragraph. 

       

      ARTICLE
        IV.

       

      THE
        SECURITIES

       

      Section
        4.01. The
        Certificates.

       

      The
        Certificates shall be designated generally as the Mortgage Pass-Through
        Certificates, Series 2007-5F. The aggregate principal amount of Certificates
        or
        Interests, as applicable, that may be executed and delivered under this Trust
        Agreement is limited to $723,453,809, except for Certificates executed and
        delivered upon registration of transfer of, or in exchange for, or in lieu
        of,
        other Certificates pursuant to Section 4.05 hereof or Sections 5.03 or 5.05
        of
        the Standard Terms. On the Closing Date, the Securities Administrator shall
        execute, and the Certificate Registrar shall authenticate and the Certificates
        in the names and amounts and to the Persons as directed by the Depositor.
        The
        table in Section 2.03 sets forth the Classes of Certificates, the initial
        Certificate Balance and the Certificate Rate for each Class of the Certificates.
        The Certificates authorized by this Trust Agreement shall consist of the
        Certificates having the designations, Initial Certificate Balances and
        Certificate Rates specified in the table in Section 2.03(d).

       

      Section
        4.02. Denominations.

       

      Each
        of
        the Class A and Subordinate Certificates shall be issued in fully registered,
        book-entry form and shall be Book-Entry Certificates. Each Class of Residual
        Certificates shall be issued in fully registered, certificated form. The
        Class A
        Certificates are offered in minimum denominations of $25,000 initial Certificate
        Balance each and multiples of $1 in excess of $25,000 or, if the Class Principal
        Balance of such Class of Certificates is less than $25,000, the Class Principal
        Balance thereof. The Subordinate Certificates are offered in minimum
        denominations of $250,000 initial Certificate Balance each and multiples
        of $1
        in excess of $250,000. In addition, one Certificate of each Class (other
        than
        the Residual Certificates) may be issued evidencing the sum of an authorized
        denomination thereof and the remainder of the initial Class Principal Balance
        of
        such Class. Each Class of Residual Certificates shall be issued in percentage
        interests of 99.99% and 0.01%.

       

       


      
        
          
          

        

        
          20

          
            

          

        

        
          
          

        

      


      Section
        4.03. Redemption
        of Certificates.

       

      (a) There
        shall be no right to redemption pursuant to Section 10.01 of the Standard
        Terms.
        Moreover, notwithstanding anything to the contrary in Section 10.02 of the
        Standard Terms, the obligations created by this Trust Agreement shall terminate
        upon payment to the Certificateholders of all amounts held in the Collection
        Account, the Certificate Account and the Distribution Account required to
        be
        paid to the Certificateholders pursuant to this Trust Agreement, following
        the
        final payment or other liquidation (or any Advance with respect thereto)
        of the
        last Mortgage Loan remaining in the Trust Estate or the disposition of all
        property acquired upon foreclosure of any such Mortgage Loan.

       

      (b) On
        or after the date on which the aggregate Scheduled Principal Balance of the
        Mortgage Loans
        is less than or equal to 1% of the aggregate Scheduled Principal Balance
        of such
        Mortgage Loans as of the Cut-Off Date the Master Servicer shall have the
        right
        to purchase the remaining Mortgage Loans and any other assets in REMIC I
        at the
        Termination Price and thereby cause the retirement of the related
        Certificates.

       

      Notwithstanding
        anything to the contrary contained herein, the obligations created by the
        Trust
        Agreement shall terminate upon payment to the Certificateholders of all amounts
        held in the Certificate Account and the REMIC I Distribution Account required
        to
        be paid to the Certificateholders pursuant to the Trust Agreement, following
        the
        earlier of: (i) the final payment or other liquidation (or any Advance with
        respect thereto) of the last Mortgage Loan remaining in the Trust Estate
        or the
        disposition of all property acquired upon foreclosure of any such Mortgage
        Loan
        and (ii) the purchase of all of the assets of the Trust Estate as provided
        above. Written notice of termination shall be given to each Certificateholder,
        and the final distribution shall be made only upon surrender and cancellation
        of
        the Certificates at an office or agency appointed by the Securities
        Administrator, which shall be specified in the notice of termination. Any
        repurchase of the assets of the Trust Estate pursuant to this Section 4.03
        shall
        be made at a price equal to the Termination Price. 

       

      Section
        4.04. Securities
        Laws Restrictions.

       

      Each
        of
        the Junior Subordinate Certificates is a Private Certificate subject to the
        restrictions on transfer contained in Section 5.05(a) of the Standard Terms.
        Furthermore, each of the Private Certificates is a Rule 144A Certificate.
        The
        Class R and Class RC Certificates are Residual Certificates subject to Section
        5.05(c) of the Standard Terms.

       

       


      
        
          
          

        

        
          21

          
            

          

        

        
          
          

        

      


      ARTICLE
        V.

       

      MISCELLANEOUS
        PROVISIONS

       

      Section
        5.01. Request
        for Opinions.

       

      (a) The
        Depositor hereby requests and authorizes McKee Nelson LLP, as its counsel
        in
        this transaction, to issue on behalf of the Depositor such legal opinions
        to the
        Trustee, the Securities Administrator and each Rating Agency as may be (i)
        required by any and all documents, certificates or agreements executed in
        connection with the Trust, or (ii) requested by the Trustee, the Securities
        Administrator, any such Rating Agency or their respective counsels.

       

      (b) Each
        of
        the Trustee, the Securities Administrator and the Master Servicer hereby
        requests and authorizes its counsel to issue on behalf of such Person such
        legal
        opinions to the Depositor, GSMC and Goldman, Sachs & Co. as may be required
        by any and all documents, certificates or agreements executed in connection
        with
        the establishment of the Trust and the issuance of the
        Certificates.

       

      Section
        5.02. Schedules
        and Exhibits.

       

      Each
        of
        the Schedules and Exhibits attached hereto or referenced herein are incorporated
        herein by reference as contemplated hereby and by the Standard Terms. Each
        Class
        of Certificates shall be in substantially the form attached hereto, as set
        forth
        in the Exhibit index.

       

      Section
        5.03. Governing
        Law.

       

      THIS
        TRUST AGREEMENT SHALL BE GOVERNED BY AND CONSTRUED IN ACCORDANCE WITH THE
        LAWS
        OF THE STATE OF NEW YORK, WITHOUT REFERENCE TO ITS CONFLICT OF LAW PROVISIONS
        (OTHER THAN SECTION 5-1401 OF THE GENERAL OBLIGATIONS LAW), AND THE OBLIGATIONS,
        RIGHTS AND REMEDIES OF THE PARTIES HEREUNDER SHALL BE DETERMINED IN ACCORDANCE
        WITH SUCH LAWS.

       

      Section
        5.04. Counterparts.

       

      This
        Trust Agreement may be executed in any number of counterparts, each of which
        so
        executed shall be deemed to be an original but all of such counterparts shall
        together constitute but one and the same instrument.

       

      Section
        5.05. Notices.

       

      All
        demands and notices hereunder shall be in writing and shall be deemed to
        have
        been duly given if personally delivered at or mailed by first class mail,
        postage prepaid, or by express delivery service, to (a) in the case of the
        Depositor, 85 Broad Street, New York, New York 10004, Attention: President
        (telecopy number (212) 902-3000 and email addresses: sang.kim@gs.com and
        michelle.gill@gs.com) or such other address, telecopy number or email address
        as
        may hereafter be furnished to each party to this Trust Agreement in writing
        by
        the Depositor; (b) in the case of the Trustee, U.S. Bank National Association,
        One Wall Street, Suite 1600, New York, New York 10005, Attention:
        Structured Finance Department, GSR 2007-5F,
        or such
        other address or telecopy number as may hereafter be furnished to each party
        to
        this Trust Agreement in writing by the Trustee; (c) in the case of the Master
        Servicer, Wells Fargo Bank, N.A., P.O. Box 98, Columbia, Maryland 21046,
        Attention: Client Manager (GSR 2007-5F) (or in the case of overnight deliveries,
        9062 Old Annapolis Road, Columbia, Maryland 21045) Telephone: (410) 884-2066;
        Facsimile: (410) 715-2380, or such other address, telecopy number or email
        address as may hereafter be furnished to each party to this Trust Agreement
        in
        writing by the Master Servicer; (d) in the case of the Securities Administrator,
        Wells Fargo Bank, N.A., Sixth Street and Marquette Avenue, Minneapolis,
        Minnesota 55479, Attention: Corporate Trust Services: GSR 2007-5F, or such
        other
        address, telecopy number or email address as may hereafter be furnished to
        each
        party to this Trust Agreement in writing by the Securities Administrator;
        and
        (e) in the case of each Custodian, the addresses set forth in the Custodial
        Agreement with respect to such Custodian. The addresses of the rating agencies
        required to be stated herein pursuant to Section 13.08(d) of the Standard
        Terms
        are Fitch Ratings, One
        State Street Plaza, New York, New York 10004
        and
        Standard & Poor’s Ratings Services, 55 Water Street, New York, New York
        10041.


      
        
          
          

        

        
          22

          
            

          

        

        
          
          

        

      


      


      [Signature
        page follows]

       


      
        
          
          

        

        
          23

          
            

          

        

        
          
          

        

      


      IN
        WITNESS WHEREOF, the Depositor, the Trustee, the Master Servicer, the Securities
        Administrator and each Custodian have caused this Trust Agreement to be duly
        executed by their respective officers thereunto duly authorized and their
        respective signatures duly attested all as of the day and year first above
        written.

       

      


      GS
        MORTGAGE SECURITIES CORP.,

      as
        Depositor

      


      By:
        /s/
        Greg A. Finck        

      Name:
        Greg A. Finck

      Title:
        Managing Director

      


      


      U.S.
        BANK
        NATIONAL ASSOCIATION,

      not
        in
        its individual capacity, but solely in 

      its
        capacity as Trustee under this Trust Agreement

      


      By:
        /s/
        Patricia O’Neill        

      Name:
        Patricia O’Neill

      Title:
        Vice President

      


      


      WELLS
        FARGO BANK, N.A.,

      not
        in
        its individual capacity, but solely in its capacity

      as
        Securities Administrator and Master Servicer

      


      By:
        /s/
        Martin Reed        

      Name:
        Martin Reed

      Title:
        Vice President

      


      



      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      


      DEUTSCHE
        BANK NATIONAL TRUST COMPANY, 

      not
        in
        its individual capacity, but solely in its

      capacity
        as Custodian

      


      By:
        /s/
        Andrew Hays        

      Name:
        Andrew Hays

      Title:
        Associate

      


      


      By:
        /s/
        Norma L. Catone        

      Name:
        Norma L. Catone

      Title:
        Vice President

      


      


      


      U.S.
        BANK
        NATIONAL ASSOCIATION, 

      not
        in
        its individual capacity, but solely in its

      capacity
        as Custodian

      


      By:
        /s/
        Patrick Garay-Heelan        

      Name:
        Patrick Garay-Heelan

      Title:
        Assistant Vice President


      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      


      Solely
        for purposes of Section 2.01(a), 

      accepted
        and agreed to by:

       

      GOLDMAN
        SACHS MORTGAGE

      COMPANY

      


      By: Goldman
        Sachs Real Estate Funding

      Corp.,
        its General Partner

      


      


      By:
        /s/
        Greg A. Finck__________________

      Name:
        Greg A. Finck

      Title:
        Managing Director

      


      



      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      SCHEDULE
        I

      


      Mortgage
        Loan Schedule

      


      


      



      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      SCHEDULE
        II

      


      [Reserved]

      



      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      SCHEDULE
        III

      


      [Reserved]


      
        
          
          

        

        
          
          

          
            

          

        

        
          
          

        

      


      


      EXHIBIT
        A

      


      Form
        of
        Certificates


      
        
          
          

        

        
          A-1