download function complete