added better tmp file handling as well as chunking file size downloads.