updated click function