When Liz Harvey took over as headteacher at Newmilns primary five years ago, she was concerned at some of the behaviour she saw and the level of conflict among children at play.
Newmilns covers large pockets of deprivation and has several pupils with special educational needs, including social, emotional and behavioural difficulties.
"There was a core of children who were very challenging and it was having an effect on the others," Ms Harvey said at a seminar on the project.
She added: "The doors were all closed, the glass on the doors was covered up. The ethos was not right, yet there were a lot of positive things happening."
Ms Harvey decided to make changes and was keen to involve everyone in the process, from kitchen and clerical staff to teachers, parents and pupils.
Focus groups were set up to identify issues and to propose positive ways of rewarding good behaviour. Sanctions were also agreed for those displaying challenging behaviour.
Rewards included amassing points towards certificates for good work and behaviour, extra playtime and access to a television, DVD and music room for up to 30 minutes a month.
A partnership contract outlining rights and responsibilities of parents, pupils and staff was created. "Chat buddies" (adult supervisors) and "playground pals" (senior pupils) were appointed to provide support to children.
In the three years since the project started, Ms Harvey said she has seen a transformation in the openness of pupils and staff. All doors are left open and children no longer have to line up when coming in from play.
"I now have pupils who want to come to school and pupils who know how to get help if they need it," she said. "The ethos is better. The interaction between pupils and staff is better."
Pupils were not afraid to put forward ideas, "and some of those are better than ours". One example was playground equipment and games which the children helped to design and which will be ready when the new term starts next week.