added event variable to on click function