William Johnston, who has died aged 63, was an inspirational headteacher whose guiding hand ensured historic but fire-ravaged Aberdeen Grammar School emerged from the ashes to renewed success.
He arrived at the school the year after it had been badly damaged by a blaze in 1986 and oversaw its restoration as well as the challenge of building a positive vision for the future.
Earlier in his career, in the east end of Glasgow, his flair for teaching was already evident when he instilled an enthusiasm for science in the girls by producing a chemistry set for them to make their own lipsticks.
The son of a postman, he was educated at Beith Academy and Spiers School, Beith. He graduated with a BSc (Hons) in chemistry from Glasgow University in 1969 and worked briefly with ICI Marketing in Manchester before doing his teacher training.
In his early teaching career in Glasgow he worked with some of those not expected to do well but did his best to inspire them. When some pupils said they were never allowed "brainy books" - the expensive hardback jotters reserved for the "brainy" pupils - he tracked some down and dished them out to them.
In 1975, he moved to Glenrothes High as assistant principal teacher before taking up a post as principal teacher at Millburn Academy, Inverness, in 1978.
His rapid rise through the ranks saw him become assistant rector at Kingussie High three years later, followed by depute rector at Culloden Academy, Inverness, in 1984. He was only 39 when he became a headteacher, taking on the rectorship of Aberdeen Grammar in 1987.
The city's oldest school, Aberdeen Grammar's most famous former pupil is Lord Byron. In July, 1986, a fire destroyed about 70 per cent of the school, including the library and a collection of Byron's notebooks.
Mr Johnston retired in 2004 and became a consultant to Aberdeen City Council's education department and a project manager with NHS Grampian. He had also been a governor of Robert Gordon University between 1997 and 2006.
Having gained a diploma in educational technology in 1986, in retirement he achieved first class honours in an MA in Gaelic studies from Aberdeen University last year and was in the process of completing his PhD.
Aside from education and music, his other great passion was hillwalking; he was a member and former chairman of Cults Hillwalking Club. He had completed more than 100 Munros, the last 16 during the five-day holiday on which he died while walking on Creag nan Damh in Glen Shiel.
He was widowed in 2003 after 30 years of marriage to wife Katie, a business studies teacher.