re-factor buttons, add click events