coterminous with the affordability period established under paragraph (6), with the frequency and amount of repayments to be determined by requirements established by the Secretary. (5) Loan modifications or forgiveness With respect to loans provided under this section, the Secretary may take any of the following actions if the Secretary determines that doing so will preserve affordability of the project: (A) Waive any due on sale or due on refinancing restriction. (B) Consent to the terms of new debt to which the loans may be subordinate, even if such new debt would impact the repayment of the loans. (C) Extend the term of the loan. (D) Forgive the loan in whole or in part. (6) Extended affordability period Each recipient of loan assistance under this section shall agree to an extended affordability period for the project that is subject to the loan by extending any existing affordable housing use agreements for an additional 30 years or, if the project is not currently subject to a use agreement establishing affordability requirements, by establishing a use agreement for 30 years. (7) Matching contribution Each recipient of loan assistance under this section shall secure at least 20 percent of the total cost needed to make the necessary physical improvements from non-Federal sources, except in cases where the Secretary determines that a lack of financial resources qualifies a loan recipient for— (A) a reduced contribution below 20 percent