now using events to detect the pin click