Improve serialization and header handling.
Improve serialization and header handling.