add download attachments functions