The decision to seek a master’s degree can be fraught with worries over the cost, the time, and the ultimate payoff. For Kathy Phelps it took only seconds to say, “Heck, yeah.” Not only was her $30,000 tuition waived, but the teachers came to her office. The weekly three-hour classes were held inside a conference room just one floor down from her desk inside Dixon Schwabl, an ad agency just outside Rochester, N.Y.

By the end of the 16-month program, Phelps received her master’s in strategic marketing from Roberts Wesleyan College and also positioned herself as a comer at the company, joining a key leadership committee and getting a raise to boot. Says Phelps, 35, who is now a vice president: “This is where I’m going to be for the rest of my career.”

That’s the idea. The on-site master’s degree program, launched a decade ago, is one of many reasons Dixon Schwabl regularly shows up on Fortune’s list of 50 Best Small and Medium-Size Companies to Work For. The firm has a philanthropic and employee-­centered culture where staffers are privy to company financials and enjoy perks like paid time off for volunteering, impromptu ice cream breaks, and scavenger hunts. The company is flooded with résumés and retains 91% of its hires. “We want to motivate people to come to work every day,” says ­Lauren Dixon, the company’s cofounder and CEO.

Read More: These Are the 10 Best Workplaces in Advertising and Marketing

The master’s program got its start after Dixon discovered that Roberts Wesleyan College, which is a client, needed classroom space to reach students on the east side of Rochester near Dixon Schwabl’s offices. It takes 50 minutes to drive across town from the college campus.

Dixon agreed to provide conference rooms for two degree programs, one on strategic marketing and the other on strategic leadership. She offered up the firm’s 115 employees as guest speakers and provided real-world case studies, as well as access to the agency’s editing, video, and recording equipment. In exchange, the ad agency received two free seats per session in each program.

Dixon Schwabl isn’t a typical classroom setting, says Roberts Wesleyan president Deana Porterfield. The lobby has a twisting slide; bright, funky art covers the walls; and there’s the lively bustle of a company engaging in the very processes that the students are studying. “It’s dynamic,” Porterfield says. She’s seeking similar corporate partnerships to house other master’s programs.

For Schwabl, sharing office space has created an opportunity for easy, free leadership training. Six Dixon Schwabl employees have received their master’s this way (with four more in the program now), and all have risen to leadership positions in the company. It also raises the agency’s visibility with the students, who could become future employees or clients. “We can shout from the rooftops what we do,” Dixon says. In other words, it’s great advertising.

Read More: Here’s the Secret to How the Best Employers Inspire Workers

A version of this article appears in the September 15, 2016 issue of Fortune with the headline “Getting schooled at work.”