Refactoring. Use d3 in place of jQuery.