refact uploader.js