move exceptional cases into first part of branch
move json responder into own function
move csv responder into own function
remove else after tail call
remove more if-else constructs
Merge pull request #443 from mk270/tva/export-to

tidy up export_to