Added reset attachments routine and made click handler functions to reattach listeners