This value (`showAlerts`) is passed to the function, so you don't need to use the global flag in it.