When the Halawis, a family of Syrian haberdashers, wanted to get from Greece to Macedonia on Wednesday, they took a direct coach from Athens to the last hotel before the border. At the border itself, they joined group number 106, a line of 50 fellow Syrians waiting patiently to cross into Macedonia. Group 105 was already over the other side.

“There is a system,” 28-year-old Assad Halawi nodded approvingly, as he and his sister waited in line. In his arms he held Amr, his one-year-old nephew. Amr’s parents could not afford the trip from Syria, where the civil war has destroyed the family’s home in Aleppo, and two of their shops. So Halawi has carried him from Aleppo, and will soon take him into Macedonia.

Once there, the Halawis will swiftly receive transit papers at a camp that was built recently for this specific purpose. Before long, they’ll amble over to a new, makeshift station assembled in recent weeks solely for refugee use. By the evening a special train will have taken them straight to the Serbian border.

“The wait is long, and there is no free water,” says Halawi, as he hugs Amr. “But the police are gentle, and 50 people just go to the police, get a number, and then walk through. It is organised.”

It is also the latest example of an increased pragmatism from the governments of the Balkan countries that line the refugee route from Turkey to the European Union.

When Syrians came this way a month or two ago, Greece and Macedonia both pretended that their passage could be prevented or ignored. Back then, refugees usually had to walk 40 miles to the border. Once there, the Macedonians twice tried to stop people entering, blocking the way with a line of policemen and troops, sparking terror and pandemonium. When they relented, the sudden flow of refugees swamped the nearby town of Gevgelija, as hundreds queued outside the police station for papers, and scrambled to squeeze into carriages at the town’s small train station.

“It was a bad situation,” said Jane Janiv, a waiter who watched it all unfold from his home next to the station. “Every day, two or three thousand were coming and they were sleeping in the streets, they were sleeping in the parks.”

That’s all changed. Now the Greeks allow refugees to take a bus to the border, where the Greek police manage how many can approach it at any one time. And on the other side, the Macedonians have built a new camp and station platform where several thousand refugees are given paperwork and allowed onto trains every day – without even having to enter Gevgelija.

Refugees have a rest at the Hotel Hara on the Greek side of the border at Eidomeni. Photograph: Antonio Olmos/The Observer

Leonardo Leonelli, a coordinator at the UN refugee agency, which is helping to run the camp, is relieved. “The chaos that we saw is not happening any more,” says Leonelli, standing near a long line of toilets and tents that arrived in recent weeks. “It’s still a work in progress, but we know we are getting somewhere.”

These are the growing pains of a continent that once tried to ignore the biggest wave of mass-migration since the second world war, but which is increasingly having to work out ways of managing it. Even Hungary, two borders to the north, is having to change its approach on the ground – albeit to a far lesser extent. In terms of rhetoric, Hungary remains firmly opposed to refugees, although about 160,000 have crossed its borders so far this year. Notoriously, Hungary has even built a barbed-wire fence to stop them.

A father plays with his daughter while waiting to board a bus at the Serbian-Hungarian border. Photograph: Antonio Olmos/The Observer

But on the ground, the Hungarians have quietly had to adopt a more pragmatic response. After refugees entered the country anyway, using sleeping bags and clothes to blunt the fence’s barbs, the government began to allow thousands to cross through one specific point in the fence, instead of crossing in dribs and drabs along its entire length.

This decision allows Hungarian policemen to funnel most of them into registration camps – a fulfilment of its EU obligations – before allowing them to take trains into Austria, and then Germany.

Refugees charge their phones via a power outlet connected to a generator. Photograph: Antonio Olmos/The Observer

But the fact they have been allowed to gather there in the first place ultimately represents a change in tactics from the government, said Magdalena Majkowska-Tomkin, head of the International Organisation of Migration in Hungary.

“They are letting people in, and they are letting them take the trains,” said Majkowska-Tomkin. “But they don’t have enough [officials] to register them – and that’s why people are still waiting.”

Hungary may change its approach again on 15 September, when new laws will criminalise the act of crossing and damaging the fence. But Majkowska-Tomkin believes even these new measures may be unworkable.

“The prison system has only 13,000 places, which are already full,” she said. “So I don’t see how they could conceivably arrest large numbers of people arriving every day. In many ways it is unenforceable.”