clean d3 code