refactor click events