Add serialization code

Have fun!