refactor client upload and chunked streams