; and (ii) is accredited as an inpatient nonhospital facility, inpatient nonhospital detoxification facility, or residential facility, by a national accrediting organization recognized by the Secretary for this purpose and is accredited or licensed by a State accrediting or licensing agency for substance use disorder treatment. . (b) CHIP Section 2110(b)(2)(A) of the Social Security Act ( 42 U.S.C. 1397jj(b)(2)(A) ) is amended by inserting after an institution for mental diseases the following: (other than with respect to residential substance use disorder treatment services, as defined in section 1905(h)(3)(A)) . (c) Effective date; construction (1) Effective date The amendments made by this section shall apply to items and services furnished on or after July 1, 2017. (2) Construction Nothing in this section shall be construed as affecting the availability of Federal financial participation for medical assistance under title XIX of the Social Security Act (or for child health assistance under title XXI of such Act) for inpatient services furnished, before the amendments made by this section are implemented, in an inpatient nonhospital facility, inpatient nonhospital detoxification facility, or residential facility, that is primarily engaged in furnishing inpatient services in the treatment of substance use disorder services.