refactor uploading