clean code
add detached event handle