Minor refactoring of lazy datum serialization.
Adds unit test for lazy datum (de-)serialization