D3 js improvement