Take a more OO approach to handling the d3 data

If you've tried, then I'm happy for us to keep it. Apologies for the
running around.