added code for handling downloaded file