WARSAW, Poland (AP) — Poland’s new prime minister reshuffled his Cabinet on Tuesday, ousting the controversial ministers of foreign affairs, defense and the environment in a move aimed at mending relations with partners in the European Union.

Mateusz Morawiecki, who became prime minister in December replacing Beata Szydlo, is seeking to improve Poland’s deteriorating position in the EU and head off possible EU sanctions.

Later in the day, the office of the European Commission’s head, Jean-Claude Juncker, said the two had a “friendly” and “constructive” dinner in Brussels and would be seeking to make progress on better ties by the end of February.

EU leaders have raised a series of concerns over Poland’s changes to its justice system, government-approved logging in an old forest and refusal to take in migrants under an EU plan. They have opened a sanctioning procedure that could strip Poland of its EU voting rights.

Morawiecki said at a news conference sought to explain to Juncker the goal of the changes in the justice system and that they are long-awaited and necessary.

“I said that our intentions are aimed at making the system more efficient, more just and more objective” as well as transparent and cost-efficient, he said.

Other themes included energy and climate policy as well as the approximately 1 million Ukrainians fleeing the conflict with Russia who have been given refuge in Poland.

In making his government reshuffle, Morawiecki seemed to have persuaded Poland’s most powerful politician, ruling party leader Jaroslaw Kaczynski, that the Cabinet ministers most criticized by EU leaders and by the opposition should go.

“We are not and we don’t want to be a dogmatic, doctrinal government, or a government of socialist or neo-liberal extremities,” Morawiecki said during a swearing-in ceremony for the new ministers at the Presidential Palace.

He said he wants Poland to have an important role in a strong Europe.

The composition of the new government suggests Poland is attempting a more conciliatory approach to the EU.

“I see it as a continuation of the drive to calm the situation and the emotions in areas where conflict was not needed” including the environment and the defense sectors, said Malgorzata Bonikowska, head of the Centre for International Relations think tank.

The removals of Foreign Minister Witold Waszczykowski and Environment Minister Jan Szyszko, whose decision to cut trees in the pristine Bialowieza Forest has led to a procedure against Poland at the European Court of Justice, shows a will to mend fences within the EU. They were respectively replaced by Jacek Czaputowicz, the deputy foreign minister, and by a government economic expert, Henryk Kowalczyk.

The new defense minister is Mariusz Blaszczak, the former interior minister, replacing a minister blamed for abruptly cancelling a deal to buy French-made helicopters.

Morawiecki kept Justice Minister Zbigniew Ziobro, the author of the sweeping reform of the justice system, in a sign that he backs the changes.

New finance and development ministers were also appointed as the jobs were vacated by Morawiecki when he became prime minister.