Serialization code and tests added.