Based on gelicia https://gist.github.com/gelicia/4966973 + Mike Bostock http://bl.ocks.org/3943967