updates to better handle attachments