I have not confirmed this, but I feel like the code that cleans up the DOM for the next insertion also needs to clean up any attachments area? If not, it may be worth a comment. If attachments cleanup is needed, then this may just be "clearDom".