Switched from constructors to functions in serialization code