adding fetch attachments function