refactor file uploader