smarter serialization