Move D3 code to a module