rewrite so that all data is serializable with JSON.