CSV writer

Worked on CSV writers, began adding functionality to mongodb script.