Added rough utility functions to prepare data for use in D3 charts.