Fixes most problems with #32. NVD3 may still have some problems but a big improvement