rewrite download thread by using config object
remove unused files and finish implementation of download