Click handler logic