big rewrite of the file. accepts POST data and generates the download file. Unfinished but executes