corrected references to global object
created CSV.js

shamelessly stolen from: http://stackoverflow.com/a/12785546/497418