added some serialization code