BRUNSWICK, Maine — A third-generation, family-owned Maine pharmacy has repositioned itself by investing in new space and equipment that are allowing it to flourish in a new market.

In some respects, Waltz Long Term Care Pharmacy in Brunswick is nothing like the retail pharmacies in most towns and cities across the country. There are no aisles of over-the-counter drugs, no counters where patients pick up prescriptions and interact with pharmacists. Nevertheless, Waltz fills and ships thousands of prescriptions each month throughout Maine.

Dean Jacobs, the company’s president and co-owner, comes from a long line of pharmacists in his family. His grandfather opened the first Waltz Pharmacy in Damariscotta in 1948, a business that eventually included several retail locations across the state.

About a decade ago, Waltz began to serve long-term care, or LTC, facilities such as nursing homes and group homes out of a back room at its Camden location. As the LTC business began to grow, Jacobs realized its potential.

To say the LTC business grew by leaps and bounds has a literal meaning for Waltz, which can take on dozens or hundreds of new patients within a single new contract. The venture quickly outgrew the back room in Camden. As the company has closed its retail pharmacy locations in the past four years (Jacobs’ parents retired from the business last year), the LTC business has flourished. One retail location, in Waldoboro, remains.

From the back room in Camden, the LTC pharmacy moved to a larger space in Topsham, “which at the time we thought was palatial,” said Courtney Oland, who co-founded Waltz LTC Pharmacy with Jacobs in 2007 and now serves as the director of pharmacy.

As the business continued to grow, Oland and Jacobs spent almost two years looking for space in the Brunswick area. They chose Brunswick because of its central location among Maine’s population centers, ensuring high numbers of potential patients and workers. They also forged a partnership with Guardian Pharmacy, which provides working capital and consultation services for Waltz, but allows it to operate as a wholly independent entity.

“They help us make well-informed decisions about where to invest our money,” said Oland. “It’s very important to our survival that we continue to do that.”

In September, Waltz moved again, this time to the Brunswick Industrial Park, where it has leased 13,000 square feet in a building owned by Brunswick Publishing Co.

In addition to renovations, the company invested in cutting-edge technology that integrates ordering, processing, delivery and billing under one roof and within one computer network. The system allows workers at every step of the process to check and double-check prescriptions for accuracy, which is absolutely crucial in the pharmacy business.

There are machines that count pills and seal them into day-by-day bubble packs and others capable of slicing tablets into perfect halves or quarters. A bar-coding system requires checks at every stage in the process — and sets off a siren if it detects a mistake. And a computer program measures workload in each of the company’s departments — the results of which are broadcast on large-screen televisions throughout the facility — so employees can quickly shift to another area that’s busier than theirs.

Despite all that technology, Jacobs and Oland said what separates Waltz from other LTC pharmacies remains customer support. The nine pharmacists on staff spend about half their time at the Brunswick headquarters and half their time on the road consulting with clients. In that respect, their role is not unlike a retail pharmacist’s job of ensuring that the right drugs treat the right ailments without harmful side effects.

Just two months after moving to the Brunswick building, Waltz and its 75 employees are processing some 30,000 prescriptions a month and shipping them to more than 100 locations across Maine.

Debbie Marquis of Lisbon said she was a bank teller before Waltz hired her and trained her to be a pharmacy technician.

“It’s the best job I’ve ever had,” she said while placing pills into a counting device. “Counting pills is much cleaner than counting money.”

Jacobs said he sometimes misses his days working in a retail setting, but only sometimes.

“I began to realize that in the future, making investments in retail pharmacies was not going to be a good business decision,” he said. “I realized that we could grow our customer base from this one facility. I love the business of pharmacy, but it’s a hard business.”

Christopher Cousins has worked as a journalist in Maine for more than 15 years and covered state government for numerous media organizations before joining the Bangor Daily News in 2009.