removed some redunant code with d3js