Moving the serializing code into its own files.