changed d3js code layout structure. now everything is in variables