refactor uploader function and some other refine