Fixed the bugs from converting the code into a single page and using d3.json.

might have problems on chrome but ok on firefox