Added some low level serialization/deserialization code