I don't see `$attachments` being defined anywhere