serialized and wrote to file