After several years of outsourcing IT functions outside the U.S., a number of major companies are bringing them back home.

Most recently, the subject is Target, which had begun outsourcing IT in 2004. The retailer, which was hit by a data breach in 2013, announced in September that it was bringing IT in-house and hiring up to 1,000 more IT staffers, writes Kim Nash in the Wall Street Journal. “Target Corp. plans to reduce technology outsourcing as it looks to hire 500 software engineers and others to focus on mobile and online using open source tools,” she writes.

“We’ve got to a stage where almost half the team is in third parties. It’s unhealthy,” Target CIO Mike McNamara told Nash.

Whether you call it “insourcing” or “reshoring,” the trend is thought to have started with General Motors. The auto giant announced in 2012 that it intended to bring back 10,000 IT jobs to the U.S. in the next three to five years, flipping its percentage of outsourced work from 90 percent to 10 percent and vastly simplifying its IT structure.

“GM plans to cut the automaker’s sprawling list of IT applications by at least 40 percent and move to a more standardized platform,” reported Reuters at the time. “GM will also simplify the way it transmits data. The automaker will shift from 23 data centers worldwide to just two.” The company also required employees to provide a cost-benefit analysis of new IT projects, and planned to expand recruiting efforts and hire new college graduates, Reuters added.

GM was followed by several other major companies, including Bank of America and American Express in 2013, and Visa earlier this year. In September, Visa said it had hired 1,000 IT staff and expected to hire a total of 2,000 by 2017. “Visa sees competitive advantage in bringing technology talent in-house rather than using contractors,” Nash writes. A number of companies brought offshore manufacturing back to the U.S. at the same time for similar reasons.

While outsourcing was originally established to save money, organizations found that those savings didn’t necessarily materialize. “Although providing these types of services locally comes at higher rates, the actual total-cost-of-ownership (TCO) can be attractive if you factor in higher productivity, fewer errors through better communication, and faster time to market,” wrote Scott Staples in InformationWeek in 2013, not long after General Motors made its announcement.

“The true cost of outsourcing is not properly measured,” IT researcher and outsourcing critic Dr. Art Langer told James Bargent in Nearshore America. “The easy way to measure it is to say the rate is lower, but there are costs of losing ownership and control, there are costs in the increased amount of time and rework that has occurred.” Offshore outsourcing was also blamed for a number of high-profile outages in British banks.

Another advantage to insourcing besides costs? Intellectual property, Nash writes. “Keeping the intellectual property created by in-house software engineers preserves competitive advantage,” she writes. “Strategic use of technology to make the supply chain more efficient and cut the time getting products to customers can boost Target’s market advantage against other retailers”—and Target doesn’t have to worry about the technology being sold to its competitors.

This is particularly true as Target enhances the digital platform for its stores, even telling online shoppers on which aisle in the store they can find merchandise.

That’s not to say that the outsourcing baby needs to be thrown out with the bathwater. “Traditional outsourcing and offshoring makes sense for application development and AMS if real-time or near-real-time customer interaction is not required,” Staples notes.

So when should you look at insourcing? Here’s some use cases Staples recommends:

Agile development

Application maintenance and support (AMS)—for apps that require same- or near-time zone support or follow-the-sun support models

Business intelligence—for reporting where business users want quick response times

Testing—where more customer interaction is required

Mobility—because rapid prototyping and heavy customer interaction are required

Application development—for apps that require more business interaction or a follow-the-sun model

Of course, the downside to this insourcing movement is that competition could make it even harder to find qualified staff. On the other hand, as the saying goes, a rising tide lifts all boats—including yours.