; and (iv) in subparagraph (E)— (I) in clause (i), by adding and at the end; and (II) in clause (ii), by striking the period at the end and inserting a semicolon; (C) in paragraph (5)(C), by striking Indian tribes and all that follows through applicable to the detention and confinement of juveniles and inserting Indian tribes that agree to attempt to comply with the core requirements applicable to the detention and confinement of juveniles ; (D) in paragraph (7)— (i) in subparagraph (A), by striking performs law enforcement functions and inserting has jurisdiction ; and (ii) in subparagraph (B)— (I) in clause (iii), by striking and at the end; and (II) by striking clause (iv) and inserting the following: (iv) a plan to provide alternatives to detention for status offenders, juveniles who have been induced to perform commercial sex acts, and others, where appropriate, such as specialized or problem-solving courts or diversion to home-based or community-based services or treatment for those youth in need of mental health, substance abuse, or co-occurring disorder services at the time such juveniles first come into contact with the juvenile justice system; (v) a plan to reduce the number of children housed in secure detention and corrections facilities who are awaiting placement in residential treatment programs; (vi) a plan to engage family members, where appropriate, in the design and delivery of juvenile delinquency prevention and treatment services, particularly post-placement; (vii) a plan to use community-based services to respond to the needs of at-risk youth or youth who have come into contact with the juvenile justice system; (viii) a plan to promote evidence-based and trauma-informed programs and practices