Re-implemented using D3js .data() function