added comments
formatting
replaced my coloring algorithm with D3's color scales