serialization example extended slightly