Updated serialization to use -persistentType and -type as necessary