The class on dramatic irony promised to be cool. Seniors in Nicole Roeder's English class at Quakertown Community High School had to watch a set of videos, including the trailers from Ferris Bueller's Day Off and a scene from Othello as interpreted by two different theater troupes.

But the computer program wasn't working, and the Othello scenes had stalled. So Cheyenne Knight, 18, switched gears, to her physics class. First she stopped to chat with the student next to her, a junior, who was slowly typing up a chemistry lab with a Wikipedia article on magnesium oxide pulled up on his screen.

Knight is one of Quakertown High's cyber students. She takes her core academic classes online; the flexible learning style of online classes fits her better, she says. Her grades are good, despite the occasional distraction and technical glitch, and she's on track to graduate this spring.

"I work a lot faster than some people," she said. "All-day school does not work for me."

The small school district of Quakertown, in Bucks County, has become a national model for how to use technology to transform the public school experience. The majority of students in the district take at least one class online, and all ninth graders are given laptops they can take to college when they graduate.

Since 2008, when the program began, Quakertown has gone from losing students to cyber charter schools to enrolling students from across the state in its online classes. Graduation rates are up, the district's budget is healthy again, and Quakertown is now showing several districts - including Philadelphia - how it's done.

"We've had increases in our student achievement," said Cindy Lapinski, the principal of Strayer Middle School in Quakertown. "I don't know if it's technology, but I can say that kids outside of this building are wired 24/7, and for many of our students, that's the way they think, that's the way they operate."

"We need to make sure we have tools that match the way they're learning and thinking," she added.

In 2008, Quakertown officials were worried. Charter schools had drawn 110 of the district's students that year, resulting in an annual loss of about $10,000 each, and nearly twice that if the lost students were in special education. (When students enroll in a charter school, Pennsylvania state law requires their school district to pay the charter school for educating them.)

A handful of students went to charter schools around Allentown, but most enrolled in cyber schools. Other districts were facing the same problem: Enrollment in Pennsylvania's online charter schools, which draw students from across the state, had nearly tripled, from fewer than 4,000 in 2004-05 to more than 11,000 in 2007-08. (It is now more than 21,000.)

Quakertown officials decided to strike back by creating their own cyber education program. "We knew we could do something about the cyber charter," said Christopher Harrington, Quakertown's technology director at the time.

The district, with fewer than 6,000 students, used part of a federal grant of $263,000 from the Obama administration's stimulus program to buy computers, and found about $400,000 in its budget to upgrade its networks, hire new staff, and buy more equipment, according to Harrington.

Since one of the goals of the program was to save money, hiring a company to provide an off-the-shelf online curriculum, along with teachers to teach it, seemed foolish. "Part of the reason districts really struggle is they outsource so much of it," said Thomas Murray, who took over the technology director job from Harrington.

So Quakertown recruited its own teachers for the job.

They didn't rush to sign up. "I was the only teacher to volunteer," Roeder said. Officials eventually persuaded a small cohort; they earned extra pay to help develop curriculum and had more flexibility in their schedule and smaller class sizes.

But the 2009-10 school year, the program's first, did not go smoothly. "It was a learning curve," Roeder said. "We weren't lighting anything on fire."

The first year, about 40 students enrolled. Now, 220 students take a total of more than 500 classes. Most are in high school, but the district has 15 elementary-age students enrolled in cyber school full time.

The program still is not perfect. The work is not always very different from that of a traditional classroom. On one Tuesday morning in April, for instance, Maia Costanzo, an eighth grader at Strayer Middle School, had penciled in answers in a workbook that she would later scan into the computer for her teacher to grade. "I prefer paper," she explained.

Murray said the district's courses are designed so that students can easily transfer back and forth between cyber and live classrooms. "It doesn't mean they're bad, it just means they're more traditional," Murray said. But he added that the district is working on taking the class work "to the next level."

And cyber school is not for many students, or even for most. "I'm not a very good self-motivator," said Costanzo, an honor roll student who struggled after enrolling in a full load of cyber courses last fall. It was a comment repeated by many of her middle school peers. "I like to have a live teacher who I can talk to," she said.

Middle schoolteacher Damian Gomm says most students do better when they take a combination of face-to-face and cyber classes. The ones who stay home and take all their classes online tend to struggle, he said. Research bears this out: Studies suggests technology may be more powerful when used as a tool to help children learn, rather than as the primary way children are taught.

There is evidence the cyber program is improving academics, though, Quakertown officials say. The graduation rate, which does not include out-of-district students, rose from 88 percent in 2009, after the district launched its cyber program (along with a separate intervention program for struggling students), to 95 percent in 2012; its relatively high test scores for younger grades have not changed.

This year, 116 Quakertown students are enrolled in charter schools. That is slightly more than in 2008, but Murray says the number would probably be double that without the cyber program. Over the last three years, 15 to 17 students per year have returned to Quakertown schools from cyber charter schools. He keeps a running tally of how much the returned students are saving the district: In 2012-13, 15 returnees brought back $207,000.

And now, much like the cyber charter schools against which it competes, Quakertown also enrolls students from across the state in its cyber program; this year, out-of-district students took nearly 300 classes. But the goal is not to "take other people's money," Harrington says. Instead, he is consulting with districts to show them how to start their own programs. "What we're doing is we're providing schools with the tools to compete in that environment," he said. "But it's really about retooling teachers to provide 21st-century education experiences for kids."