Add code to flush collected data cache after uploading
Fix upload wrong parameter name, fix download code changing newlines to something else.
Added waiting time query but it seems like value is a bit weird?