finish function through and add file download function