Serialize complex types better