modularized click event function