New lease of life planned for fire ravaged Fife primary school