move demo and d3 functions into separate js files