Added csv export and some minor changes.