Checking and handling mouse clicks