attachment function add

add some UI logic