modularized the button event and added some actions at setting mode