Improve serialization