basic proof-of-concept, largely copied from http://bl.ocks.org/mbostock/4062045