Add serialization functions.

FS and logger are set on initialization.