Add headers to the code
Fixed a bug in the csv output