Is this for csv output? I think we should move this code somewhere else if possible.