This is incomplete. I think that I made most of the processing after file download, but I can't create a file download function that actually works.