Refactoring the SPECFEM writer.