Based on http://bl.ocks.org/mbostock/11357811