refactor main.js, add event remove