Ford Motor Co. (NYSE: F) agreed to continue producing the Fiesta, its top-selling European car, in Cologne, Germany, though it has been unprofitable since 2011.

The fate of the factory has been uncertain during the months of negotiations between management and workers, but they have finally reached a consensus to cut about $400 million in production costs starting in 2017, according to Bloomberg BusinessWeek. The penny-pinching will come from slashing night shifts, increased worker flexibility, and shifting burden from suppliers to Ford.

Barb Samardzich, chief operating officer of Ford Europe, said during a conference call, "We wanted to make the Fiesta profitable in Cologne." Employees were also concerned about a move to Romania in order to cut costs, reports Bloomberg.

Carmakers have been having trouble throughout Europe due to the economic downturn in the last five years that has affected the car market. Auto factories have been performing "significantly below full capacity amid a tepid recovery in the European car market," reported the Wall Street Journal.

The Cologne factory employs about 4,100 people and, according to Reuters, Ford is planning on hiring 500 more engineers. The car company goes on to say in a statement that the labor deal is intended to make the factory "more cost efficient, ensuring that next-generation Fiesta production will be globally competitive."