Modularize and coffeescriptify the graph drawing.