; and (ee) may not be renewed or extended; and (II) the court may not issue a second or subsequent order described in subclause (I) relating to a status offender, unless the status offender violates a valid court order after the date on which the court issues an order described in subclause (I); ; and (iv) by adding at the end the following: (D) there are procedures in place to ensure that any status offender held in a secure detention facility or correctional facility pursuant to a court order described in this paragraph does not remain in custody longer than 7 days or the length of time authorized by the court, whichever is shorter; and (E) not later than 3 years after the date of enactment of the Juvenile Justice and Delinquency Prevention Reauthorization Act of 2017 , the State will eliminate the use of valid court orders to provide secure confinement of status offenders, except that juveniles may be held in secure confinement in accordance with the Interstate Compact for Juveniles if the judge issues a written order that— (i) specifies the factual basis to believe that the State has the authority to detain the juvenile under the terms of the Interstate Compact for Juveniles; (ii) includes findings of fact to support a determination that there is no appropriate less restrictive alternative available to placing the juvenile in such a facility, with due consideration to the best interest of the juvenile; (iii) specifies the length of time a juvenile may remain in secure confinement, not to exceed 15 days, and includes a plan for the return of the juvenile to the home State of the juvenile; and (iv) may not be renewed or extended; ; (R) in paragraph (26)— (i) by inserting and in accordance with confidentiality concerns, after maximum extent practicable,