Every once in a while a postcard from some far-off location arrives at Aberdeen Prison for governor Audrey Mooney. It's from an ex-prisoner now travelling the world working as a freelance journalist - a man who turned his life around after spending most of it in jail.
"That's a guy who had never been out of prison and was reaching his late thirties. He's never been back since and is making a real success of it," she smiles. "I get postcards from all these fantastically luxurious, exotic places and he keeps reminding me of the benefits he derived from his experiences in the education unit. It was a result of the encouragement to bring him on, to bring out probably something that was there and make him realise what he could do."
This week, Scotland's chief inspector of prisons published a report condemning prisons for overcrowding and locking up remand prisoners in the "worst conditions". In some, "they hardly ever have the chance of a job to break up the day and may well spend 22 hours out of 24 locked up."
Walking through the main hall of this Victorian prison, looking up at the tiered open corridors of cells feels a bit like visiting a museum. There are plans for a new Grampian Prison but until that happens, overcrowding continues. Today, numbers are down, but there are 256 prisoners in a jail built for 150 inmates in the 1880s.
Nowadays, it's a short-term prison for remand prisoners and men serving up to four years, with one or two long-term prisoners waiting to go to other prisons. Anyone serving over four years for more serious offences goes to a long-term prison. Prisoners here have committed a range of offences - "from petty theft, breach of the peace, right through to murder", says the governor.
"We deal with very short-term prisoners, many are repeat offenders - in fact, the majority are repeat offenders but doing what you would call life sentences in instalments because they keep coming back."
Mrs Mooney is a great believer in the importance of education in this setting - for many reasons, not least because it is a valuable activity to fill a prisoner's day. "Our prisoners come in here inevitably severely damaged, both in health and mentally, and their esteem is very, very low," she says.
"You would be surprised at how little they expect. Anything we can do to restore self-esteem and to make them feel better about themselves we strive to do, and education is absolutely critical in that."
The Scottish Prison Service has a contract with Motherwell College to deliver the learning, skills and employability service here and at another eight Scottish prisons. Carnegie College in Dunfermline provides the service to another four prisons. Some prisons also offer vocational training delivered by Scottish Prison Service officers.
In Aberdeen, the contract is for a core-skills curriculum providing help with reading, writing and numeracy and opportunities to study for SQA qualifications in subjects like English, maths, computing and art or take ESOL (English for speakers of other languages) courses.
In the learning centre, 26-year-old Paul Murray has been in and out of prison since he left school at 16. "The longest I have been out is four months in the past 10 years - well, in six or seven years." He's studying computing and looks forward to these sessions: "This is a lot better than school. You can choose what courses to do and you learn more."
He's doing this to get work. "But with my record, I don't know if I'll get a job - I'll get a job, but not what I want. I'd like to work in a zoo or something like that.
"I am back on the methadone, so it's going to be a lot easier," he says. The last time he got out, he lasted just two weeks and ended up sleeping at the back of a sports centre.
He's anxious about his next release. "You don't get enough money to go out, you don't get somewhere to bide - you can see social workers and that, but you're lucky if you get a place to stay. You'd need to be on a three-year sentence to get somewhere. "When you go out to nothing, it is better in here than it is out there. I'm getting out next month - that's me going to be on the streets for Christmas," he says bleakly.
Nearby, Adam Drummond, 22, is studying numeracy, literacy, maths and IT - "just because I was in here and I wanted to get something out of it", he explains. "Like a certificate to say, 'well, maybe it was something bad going to jail, but at least something good's come out of it.' Something to show, not just sitting in a cell feeling sorry for myself."
He copes better here than he did at school. "It's more laid-back, easier. You go at your own pace and there are less people. I am making progress and the teachers are good."
Before this latest incarceration, Adam Few, 24, had been out for 18 months. "I was drug-free and doing really well. The reason I have been in prison a lot is through drugs. If I get out and go back down the same road, then this is going to be my life. I don't want that. I'm sick of it.
"So I need to get qualifications. I've got the intellect to do it, it's just you get inveigled by the same associates every time. They're not happy to see you making progress, they want to bring you down to their level. But this time I am determined I am going to work hard and I've got goals for when I do get out."
Aberdeen Learning Centre is run by Neil Morrison, who has taught here for the past 10 years. "I enjoy it. I get a lot of satisfaction because you do see a lot of progress with the guys, not just on the educational side but in their confidence and self-esteem and social skills. The downside is you tend to see a lot of guys again and again, going out re-offending, coming back in. When I first started I was quite surprised, but after 10 years you get used to it."
There are 50 to 60 students in the classrooms every week, supported by six teaching staff - four are part-time. "With the prison population we can target, because we don't do remand, I would say on average there would be about 160 prisoners that we can have access to. So it is quite a high percentage who attend," Mr Morrison explains.
"I like to think they are motivated to come over here and learn. It's informal, they seem to enjoy their learning and there's a bit of fun involved in it. Maybe it's just to get out of their cells, but I'd like to think not. I'd like to think they were coming over for the right reasons."
The learning centre is under the constant supervision of prison officers: "I've never felt threatened here. I've seen a couple of flashpoints, but in 10 years that's not a lot," says Neil. "We had a guy who attended here for about a year and we got him into Aberdeen College. Next time I met him, he was finishing his degree at Dundee University. And that was an armed robber with a drug habit - clean and everything - and I like to think that we helped him."
Not everyone here is going to graduate with honours, but every small step helps boost prisoners' self-esteem, improve job prospects and give them a better chance of staying out of prison.
It's also encouraging for staff like Shirley Gauld when they see progress. "It is rewarding and every other tutor who is in here feels the same - we all enjoy it," she says. "It depends how you measure success - it could be someone learning punctuation who had never done it before, or learning to read better or improve their vocabulary."
Ms Gauld thinks people outside have no idea what prisons are like. "When I say I work in prison, people say 'Oh, how can you do that?' Well they obviously don't have an idea of what it's like," she says.
The Scottish Government is due to review prisoners' learning and skills and the Parliament's education, lifelong learning and culture committee plans an inquiry into prison education in the new year.
Kirsten Sams, the manager of offender learning, skills and employability at Motherwell College, hopes this will result in more funding and a higher profile for prisoner education in Scotland. "There is a significant debate to be had in Scotland about how we move forward in terms of the role and significance we attach to education in prisons," she says.
"In England, they have gone down the route of preparing people for low-level entry jobs and focusing very much on skills development. While that has its place, I think there is a real danger that you will narrow the focus of an education service to the extent where you will start to put people off and lose an opportunity to build self-confidence and individuals who have a wider experience of the world."
Audrey Mooney wants to see agencies working together to provide better support for people leaving prison, so they don't end up serving life in instalments. It's sad that for some, life inside is better than on the outside. "They do want to be here, because life and relationships and support outside will never match what they get in here. Unfortunately, that's the truth," she says.
So is life better in here for someone like Paul Murray? "It is - it's nae, but it is. It's nae good for the heid, but it's good for the body."