added support for multiple attachments at once