Beginning of the write functions of the SGF