Refactor Data uploading