begin of click function