changes to some d3 code - not working yet