WHEN Emma was 14 years old she would storm out of school classes after shouting abuse at her teachers.
"I used to look for arguments," she says. "I would walk out of classes. I acted like an idiot."
Now aged 15, Emma has just sat Standard Grade exams in English, maths and history and her dream is to join the fire service when she reaches 18.
The turning point for Emma came when she was called home from her school in Edinburgh to find a social worker and a teacher from Panmure House in her living room.
"They said, 'Do you want to come to Panmure?' and I said no, because it was a big change," she explains. "But when I got here, I felt OK. Everybody was so welcoming and I felt like I fitted in. At my old school I used to feel the teachers looked down on me. Here, no-one made me feel I was underneath them.
"If anyone asked me if they should come here I'd say, 'It's worth trying.'"
Panmure House – now known as Panmure St Ann's – is a unique institution that gives another chance to young people in the capital who, for one reason or another, are unable to get along in mainstream schools.
The school support centre, formerly found off the Royal Mile in the 18th century house of economist Adam Smith, has a new home in what was formerly St Ann's Community Centre in the Cowgate.
Classes are no bigger than 12, there is a social worker as well as a teacher in every classroom and pupils only attend formal lessons for three and a half hours a day.
Headteacher Dave Simpson says that when teachers come to work at Panmure, they have to radically rethink their approach: "When we get a new member of staff here I Panmurise them," he says.
"The three Rs here are 'relationships', 'respect' and 'responsibility'. We can't do anything with the kids who get sent here unless we can make a relationship with them. We have to change their perception of the world. We can't reject them – many of them have been rejected all their lives."
To illustrate the point he pulls out a batch of pupils' writing about their home lives from a drawer. It contains matter-of-fact descriptions of chaotic homes, of parents addicted to alcohol and other drugs, of being beaten, bullied, sexually abused and raped.
In the past, the Panmure roll has included pupils working as prostitutes and drug runners. There are children who are living in secure units and residential homes. One former pupil was already a heroin addict at the age of 13.
It is no wonder that these children cannot survive in mainstream education – and it helps an understanding of why priorities at Panmure are completely different.
"A lot of these kids have attachment issues. They haven't formed an attachment to their parents at an early age and have been operating in a vacuum, so when they go into classes they have all this catching up to do," says Simpson.
"It is important to employ the right staff. They have to be non-judgemental, patient, welcoming, strong and resilient.
"It can be hard for teachers. If you say to a teacher, 'Go and have some social time with a young person,' they can struggle with that to begin with."
Panmure has an unusual history. It began as a youth club, and Dave Simpson, who trained as a teacher, was the manager.
"It was set up in the 1970s as a response to the Children's Hearing Service. It was a very bold initiative by the City of Edinburgh," he notes. "When I became involved I noticed many of these youngsters were not going to school in the daytime and I put together a plan to start teaching some of them."
The original intention was to take children out of school for a short period to offer them family therapy and anger management before returning them to mainstream education.
"A lot of them weren't going back to school – so I said that every kid who comes here will take three Standard Grades, and I'll take responsibility for that."
Panmure began with a group of 12 youngsters and now has 70 on its roll, with a further 50 on the waiting list – but Dave Simpson hopes it will not grow much bigger.
It still has something of a youth club atmosphere, with a juke box, a pool table, a canteen and areas where young people can socialise between lessons.
For many that come here, learning how to relate to others is the biggest challenge. Dave Simpson says: "Some of the kids who come here are Mr and Miss Angry, but we also have a lot of kids who are depressed. We have kids who have been bullies, but also kids who have been bullied."
The social workers – known as group workers – who are attached to every class, play a key role in helping youngsters change the way they relate to authority and to each others.
Group worker John Macnamara says: "The aim is to provide a holistic service. It is not just about getting qualifications. The aim is to help these youngsters make good choices. It is also about them feeling safe. If anyone feels unsafe here this place won't work. Often the wildest youngsters are crying out for somebody to be interested in them."
The headteacher is delighted to confound the belief that some children are "unteachable", and recently Panmure was visited by an educationalist from England who was surprised to hear that fourth year pupils were sitting exams. In similar centres down south, the emphasis is purely on rehabilitation and vocational studies.
"Two weeks ago, we entered 38 kids for standard grades in English, and 38 turned up. Two days later we had 38 kids entered for maths – and 36 turned up, including one who was in labour. After giving birth she came back a week later and took her history exam."
Panmure St Ann's also has an active Duke of Edinburgh award scheme, and Simpson has a fresh pile of certificates on his desk ready to give out.
He says: "Educational establishments are judged on their results, but these are young people that a lot of bad things have happened to.
"Some young people have come to us in the most desperate state – and yet at the end of a year and a half they are sitting in a room taking an exam. I feel that's a result."
• Some names have been changed.