Working version of deserializer.