Converted script to CSV instead of tab-delimited

I'm not sure if you care about this or not, but I cleaned up the code a little bit, and made it output to CSV instead of tab-delimited, since CSV handles weird output better sometimes. Feel free to reject the pull request if you don't want CSV. It was just easier for me, and sharing is caring.