Refactor click events