optimize a lot of  code redundancy in download and modify can repeat download bug