Click handler code cleanup