divide into prepare and attach