move the whole Attachment definition into an IIFE