Added some code for serialization

Work in progress