newer method of serialization