Some more working code
Refined serialization, working deserialization.