modified d3 slightly