prepared attach code