Refining unit tests and add deserialization helpers