refactoring xupload