Rewrite to use D3.js