Implement Serializable in some clases and make some fields transient.