added auto download function