added d3
rewriten the data saving