Beginning with the frigid winter of 2013 and through much of 2014, Minnesota farmers struggled with railroads to get grain shipped to the Pacific Northwest for export.

Growers faced long delays and steep costs to move their corn and soybeans to market, and claimed that railroad companies were favoring more lucrative oil and coal shipments.

As 2017 begins, it's a different ballgame. Low prices for oil and reduced demand for coal have reduced pressure on the rail system. And rail companies, especially BNSF, have invested billions of dollars to add workers, locomotives and track to improve service.

"There's a night and day difference between then and now," said Bob Zelenka, executive director of the Minnesota Grain and Feed Association.

Grain from Minnesota typically moves west by rail or south by barge en route to domestic and international markets, especially in Asia, he said. Minnesota was the nation's fifth largest agricultural exporting state in 2015, with sales valued at $6.3 billion, according to state and federal estimates.

Those shipments are up sharply in recent months, thanks in part to record corn and soybean harvests and yields projected in Minnesota and nationally. The surplus grain has filled storage bins across the state, said Zelenka, whose association represents about 250 grain elevators and feed mills in 450 locations.

"There's a lot of [overflow] grain in piles around the state, most of it in bunkers covered with tarps," he said.

But there's also a record amount of grain headed overseas.

John Miller, vice president for agricultural products at BNSF Railway Co., said grain shipments from the four-state area of Minnesota, Montana and the Dakotas are at all-time highs, following near-record levels in 2015. BNSF is the largest hauler of agricultural products in North America, and Miller said it invested $15 billion systemwide and $550 million in Minnesota during the past two years on improvements.

"We want to be sure the supply chain is as efficient and competitive as possible, and ready and nimble to meet whatever opportunities come along," Miller said.

One such opportunity happened in 2016, when weather problems in Brazil and Argentina resulted in smaller grain harvests than expected, and customers in China and Mexico grew nervous about currency fluctuations. The result was a surprise boost in exports for U.S. growers, enabling producers to sell corn grown in 2015 and held in storage for months because of low prices.

"As of June the Asian buyers pivoted to the U.S. for corn," said Miller, leading to an early start to the shipping season, and record summer volumes that continued through the fall as 2016 crops began to be harvested.

Keith Schrader, who grows corn and soybeans near Northfield, said demand is coming from Asian countries with a growing middle class that is eating more meat. The grain is purchased mainly for animal feed, he said, especially for poultry and pork.

"Our biggest problem is we've had three really good crops in a row nationwide, so we've just had this huge increase in supply," said Schrader, who also chairs the Minnesota Soybean Research & Promotion Council. On the negative side, that has kept prices low, he said. But plentiful grain at bargain prices has also fueled export sales.

"Most farmers that opted to raise soybeans were profitable on that crop," Schrader said. "It was the combination of a really good yield and slightly better price than what they had a year ago."

Schrader said corn prices are still below the cost of production, and because most farmers grow both corn and soybeans, they still face tight budgets. "Soybean sales are helping offset the negative cash flow that we're still experiencing for corn," he said. "The profitability hasn't been that great since 2013, and a lot of farmers have used up a lot of their working capital."

Schrader said farm credit will be an upcoming issue for many farmers in 2017, and he expects some of them will need to restructure their debt. He's also concerned by President-elect Donald Trump's campaign promises to do away with trade deals or renegotiate trade agreements.

Ed Usset, grain marketing specialist at the University of Minnesota Extension, said there's reason to be concerned.

"We have a lot at stake in the world of trade," he said. "If we want to get in a trade war over politics or whatever, the American farmer is going to learn quickly that they're at the front lines of this battle, and they'll take the first hit."

The U.S. exports nearly half its soybeans and wheat, Usset said, and increasing amounts of corn. It has also developed new markets abroad for beef, pork, cheese, nonfat dry milk and poultry, mostly in just the past decade, he said.

"Those are growth markets, and you hate to kill growth," Usset said.

Mike Steenhoek, executive director of the Soy Transportation Coalition, said that the Asian markets for U.S. grain, especially soybean meal for poultry and pork production, will only grow larger and stronger in the future. The Iowa-based coalition comprises soybean boards from 13 states, including Minnesota, and two national organizations.

"Certainly we want fair trade, but we do get concerned when we see rhetoric escalate, particularly when it's directed toward our No. 1 customer, which is China," Steenhoek said.

One-quarter of the U.S. soybean crop goes to China, he said, and even a small retraction from that would have significant impacts on soybean farmers, equipment manufacturers and other ag-related businesses. "We need to make sure that we've got fair trade agreements, but this is certainly not the time to pull back on our ability to market our products internationally," he said.