cleaned up deserializer code