add attachment funcation
merge last version