Changed class definitions to implement serialization.