In Ayr, the river flows through the middle of the town, separating the south, with its shops and residential areas, from the north, where council housing prevails.
Built in the 1960s, Mainholm Academy was the only secondary school north of the river, but in June 2006 it was closed.
When Mainholm shut its doors, its students were dispersed among the town's three remaining secondaries, which included Kyle Academy. As a result, the make-up of the academy changed significantly and the number of children from deprived backgrounds increased. The desire to ensure that no child was disadvantaged by the move prompted the school to focus on improving tracking, monitoring and self-evaluation - efforts that have not gone unnoticed by inspectors.
Kyle Academy has now been singled out as one of the best in the country and has been praised for successfully tackling one of the most intractable problems in Scottish education: closing the gap between the lowest attaining 20 per cent and the highest attaining 80 per cent.
In 2006-07, the lowest attaining 20 per cent at the school had an average "tariff" score of overall attainment at S4 - including results from Standard grades, Intermediates and Access courses - of 49. But by 2011-12 this had almost trebled to 142.
The attainment of the school's highest achieving 80 per cent had also risen from 201 to 245 points, but the gap between the two groups had shrunk from 152 to 103. Inspectors described the achievement as "commendable".
"You can't really effect change unless you know your school's strengths and areas for improvement well," said Eileen Brown, Kyle Academy's headteacher. "We know our children very well. That arises partly from our rigorous tracking systems but also (from) our very real focus on each individual."
Targets are set for each student in every subject at the beginning of the school year. A couple of times a term, using a traffic light system, subject teachers update the system to indicate whether the target is being met (green) or not (red).
The expectations of different departments are shared, and if a child is placed at National 3 or 4 in one subject but National 5 in another, teachers sit down to address the disparity.
"In setting our targets, we have found over the years that we have sometimes had to raise expectations," Ms Brown said.
If a child fails to meet the targets set in a number of departments, the year head and guidance teacher become involved, and the parents are invited into school to take part in a family support clinic. Everyone leaves the meeting with targets.
Teachers who have volunteered as mentors then take responsibility for supporting the child in school. Two years ago, Kyle Academy adopted "assertive mentoring" as a strategy. "It's about that balance between nurturing and supporting young people and challenging them," Ms Brown said.
To ensure a real commitment to self-evaluation, departments meet with the senior management team three times a year to monitor progress and set targets. This process includes a two-hour departmental presentation in the summer term.
However, closing the attainment gap is not just achieved through tracking; it is about everything a school does. "The most significant area is the ethos and culture. The school has to be a highly inclusive school where young people feel they are valued, respected and nurtured," Ms Brown said.
An "outstanding" range of opportunities for wider achievement were on offer, inspectors said, from Duke of Edinburgh's Awards to Saltire Awards, which recognise youth volunteering.
Student councils, meanwhile, were scrapped in favour of more academically focused learning councils. The school also has an eco council and a rights group. It is a Cycle Friendly School and recently embarked upon an initiative to become a Dyslexia Friendly School.
"I don't think these things raise attainment, but it does determine a culture where young people feel they are important and they can shape their school. That, in turn, makes them realise they can make a difference," Ms Brown said.
Follow this weblink to read Education Scotland's "highly effective practice" reports on the school: bit.lyKyleAcademy.