An ex-elementary teacher from New Jersey confessed to creating a music video from child pornography by secretly filming underage boys in a camp bathroom, The Daily Beast reports.

Thomas Guzzi Jr. pleaded guilty on Tuesday to official misconduct, manufacturing child pornography, and the distribution of 25 or more files of child pornography, according to the state’s attorney general, Gurbir S. Grewal.

The former fifth-grade teacher admitted that in 2015, he hid a camera in the restroom at a summer theater camp so he could record teen boys urinating. He then pieced together a music video by splicing the bathroom footage and recordings of the same boys dancing during rehearsals for a summer musical production. The 39-year-old had taken about three hours of footage during the camp. Guzzi also revealed that he had taken a photo of a boy’s genitals while teaching at a different summer program.

Guzzi was initially arrested in 2016 during a child pornography sweep conducted by Grewal’s office, state police, and Homeland Security Investigations. At that time, authorities found over 300 files of child pornography on his computers. Investigators said they traced the porn to him via his computer’s IP address. He was fired from his job and had his teaching license revoked.

“Like many child predators, Guzzi sought out positions of trust in which children were placed under his supervision,” Grewal stated in a press release, per The Daily Beast. “He then callously violated that trust by photographing and videotaping young boys for his sexual gratification, including a vulnerable student at a school where he taught. With this guilty plea, Guzzi is facing justice for so heinously betraying the innocent children who were entrusted to his care.”

The state will propose that Guzzi receive a prison sentence of 17 years and that he be required to serve 10 years before becoming eligible for parole. Guzzi’s plea agreement will demand that he register as a sex offender and be subjected to parole supervision for the rest of his life. He will be sentenced on Sept. 27.