added serialization

Discussion PR for serialization.
Not yet working.