modify destruct function
add toggle mode
refactor