generateHTML is now called on click