place scripts at end of index.html
move d3.js code into a directive

much easier to debug now ...
misc changes