Refactored the serialization / deserialization of Principals to be based on JSON