added init variables, tweaked click event handler