add the click function & delete redundancy code